Patch 8.1.2292
Problem: v:mouse_winid not set on click in popup window.
Solution: Set v:mouse_winid. (closes #5171)
Files: runtime/doc/popup.txt, src/popupwin.c,
src/testdir/test_popupwin.vim
*** ../vim-8.1.2291/runtime/doc/popup.txt 2019-11-09 15:32:51.593873994 +0100
--- runtime/doc/popup.txt 2019-11-11 21:41:17.494275335 +0100
***************
*** 863,870 ****
Tab accept current suggestion
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
! (not counting the border).
Vim provides standard filters |popup_filter_menu()| and
|popup_filter_yesno()|.
--- 863,871 ----
Tab accept current suggestion
A mouse click arrives as <LeftMouse>. The coordinates are in |v:mouse_col|
! and |v:mouse_lnum|. |v:mouse_winid| holds the window ID, |v:mouse_win| is
! 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
|popup_filter_yesno()|.
*** ../vim-8.1.2291/src/popupwin.c 2019-11-10 17:51:35.661896484 +0100
--- src/popupwin.c 2019-11-11 21:40:16.862513572 +0100
***************
*** 2915,2920 ****
--- 2915,2921 ----
(void)mouse_comp_pos(wp, &row, &col, &lnum, NULL);
set_vim_var_nr(VV_MOUSE_LNUM, lnum);
set_vim_var_nr(VV_MOUSE_COL, col + 1);
+ set_vim_var_nr(VV_MOUSE_WINID, wp->w_id);
}
}
*** ../vim-8.1.2291/src/testdir/test_popupwin.vim 2019-11-10 17:51:35.665896467 +0100
--- src/testdir/test_popupwin.vim 2019-11-11 21:43:42.545712064 +0100
***************
*** 2207,2212 ****
--- 2207,2213 ----
func MyPopupFilter(winid, c)
let g:got_mouse_col = v:mouse_col
let g:got_mouse_lnum = v:mouse_lnum
+ let g:got_mouse_winid = v:mouse_winid
return 0
endfunc
***************
*** 2221,2226 ****
--- 2222,2228 ----
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal(1, g:got_mouse_col)
call assert_equal(1, g:got_mouse_lnum)
+ call assert_equal(winid, g:got_mouse_winid)
call test_setmouse(5, 8)
call feedkeys("\<LeftMouse>", 'xt')
***************
*** 2236,2241 ****
--- 2238,2244 ----
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal(13, g:got_mouse_col)
call assert_equal(3, g:got_mouse_lnum)
+ call assert_equal(winid, g:got_mouse_winid)
call popup_close(winid)
delfunc MyPopupFilter
*** ../vim-8.1.2291/src/version.c 2019-11-10 22:36:40.626459201 +0100
--- src/version.c 2019-11-11 21:44:52.081444831 +0100
***************
*** 743,744 ****
--- 743,746 ----
{ /* Add new patch number below this line */
+ /**/
+ 2292,
/**/
--
hundred-and-one symptoms of being an internet addict:
63. You start using smileys in your snail mail.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///