mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.1.2292: v:mouse_winid not set on click in popup window
Problem: v:mouse_winid not set on click in popup window. Solution: Set v:mouse_winid. (closes #5171)
This commit is contained in:
@@ -863,8 +863,9 @@ Some recommended key actions:
|
|||||||
Tab accept current suggestion
|
Tab accept current suggestion
|
||||||
|
|
||||||
A mouse click arrives as <LeftMouse>. The coordinates are in |v:mouse_col|
|
A mouse click arrives as <LeftMouse>. The coordinates are in |v:mouse_col|
|
||||||
and |v:mouse_lnum|. The top-left screen cell of the popup is col 1, row 1
|
and |v:mouse_lnum|. |v:mouse_winid| holds the window ID, |v:mouse_win| is
|
||||||
(not counting the border).
|
always zero. The top-left screen cell of the popup is col 1, row 1 (not
|
||||||
|
counting the border).
|
||||||
|
|
||||||
Vim provides standard filters |popup_filter_menu()| and
|
Vim provides standard filters |popup_filter_menu()| and
|
||||||
|popup_filter_yesno()|.
|
|popup_filter_yesno()|.
|
||||||
|
@@ -2915,6 +2915,7 @@ invoke_popup_filter(win_T *wp, int c)
|
|||||||
(void)mouse_comp_pos(wp, &row, &col, &lnum, NULL);
|
(void)mouse_comp_pos(wp, &row, &col, &lnum, NULL);
|
||||||
set_vim_var_nr(VV_MOUSE_LNUM, lnum);
|
set_vim_var_nr(VV_MOUSE_LNUM, lnum);
|
||||||
set_vim_var_nr(VV_MOUSE_COL, col + 1);
|
set_vim_var_nr(VV_MOUSE_COL, col + 1);
|
||||||
|
set_vim_var_nr(VV_MOUSE_WINID, wp->w_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2207,6 +2207,7 @@ func Test_popupwin_filter_mouse()
|
|||||||
func MyPopupFilter(winid, c)
|
func MyPopupFilter(winid, c)
|
||||||
let g:got_mouse_col = v:mouse_col
|
let g:got_mouse_col = v:mouse_col
|
||||||
let g:got_mouse_lnum = v:mouse_lnum
|
let g:got_mouse_lnum = v:mouse_lnum
|
||||||
|
let g:got_mouse_winid = v:mouse_winid
|
||||||
return 0
|
return 0
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -2221,6 +2222,7 @@ func Test_popupwin_filter_mouse()
|
|||||||
call feedkeys("\<LeftMouse>", 'xt')
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
call assert_equal(1, g:got_mouse_col)
|
call assert_equal(1, g:got_mouse_col)
|
||||||
call assert_equal(1, g:got_mouse_lnum)
|
call assert_equal(1, g:got_mouse_lnum)
|
||||||
|
call assert_equal(winid, g:got_mouse_winid)
|
||||||
|
|
||||||
call test_setmouse(5, 8)
|
call test_setmouse(5, 8)
|
||||||
call feedkeys("\<LeftMouse>", 'xt')
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
@@ -2236,6 +2238,7 @@ func Test_popupwin_filter_mouse()
|
|||||||
call feedkeys("\<LeftMouse>", 'xt')
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
call assert_equal(13, g:got_mouse_col)
|
call assert_equal(13, g:got_mouse_col)
|
||||||
call assert_equal(3, g:got_mouse_lnum)
|
call assert_equal(3, g:got_mouse_lnum)
|
||||||
|
call assert_equal(winid, g:got_mouse_winid)
|
||||||
|
|
||||||
call popup_close(winid)
|
call popup_close(winid)
|
||||||
delfunc MyPopupFilter
|
delfunc MyPopupFilter
|
||||||
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2292,
|
||||||
/**/
|
/**/
|
||||||
2291,
|
2291,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user