diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-11-06 21:09:17 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-11-06 21:09:17 +0100 |
commit | f8b036bcae27014e4cbbdceec262b0a4c6dc2d9c (patch) | |
tree | d5a5019b4bd1641edbdfedeb9ad545327fef617a /src/testdir/test_popupwin.vim | |
parent | 638a4a7508082f8700b135953e4f9465f675a0f5 (diff) | |
download | vim-git-f8b036bcae27014e4cbbdceec262b0a4c6dc2d9c.tar.gz |
patch 8.1.2266: position unknown for a mouse click in a popup windowv8.1.2266
Problem: Position unknown for a mouse click in a popup window.
Solution: Set v:mouse_col and v:mouse_lnum. (closes #5171)
Diffstat (limited to 'src/testdir/test_popupwin.vim')
-rw-r--r-- | src/testdir/test_popupwin.vim | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim index 0a45df4e1..eab569fa9 100644 --- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -2166,6 +2166,44 @@ func Test_popupwin_filter_mode() delfunc MyPopupFilter endfunc +func Test_popupwin_filter_mouse() + func MyPopupFilter(winid, c) + let g:got_mouse_col = v:mouse_col + let g:got_mouse_lnum = v:mouse_lnum + return 0 + endfunc + + let winid = popup_create(['short', 'long line that will wrap', 'short'], #{ + \ line: 4, + \ col: 8, + \ maxwidth: 12, + \ filter: 'MyPopupFilter', + \ }) + redraw + call test_setmouse(4, 8) + call feedkeys("\<LeftMouse>", 'xt') + call assert_equal(1, g:got_mouse_col) + call assert_equal(1, g:got_mouse_lnum) + + call test_setmouse(5, 8) + call feedkeys("\<LeftMouse>", 'xt') + call assert_equal(1, g:got_mouse_col) + call assert_equal(2, g:got_mouse_lnum) + + call test_setmouse(6, 8) + call feedkeys("\<LeftMouse>", 'xt') + call assert_equal(13, g:got_mouse_col) + call assert_equal(2, g:got_mouse_lnum) + + call test_setmouse(7, 20) + call feedkeys("\<LeftMouse>", 'xt') + call assert_equal(13, g:got_mouse_col) + call assert_equal(3, g:got_mouse_lnum) + + call popup_close(winid) + delfunc MyPopupFilter +endfunc + func Test_popupwin_with_buffer() call writefile(['some text', 'in a buffer'], 'XsomeFile') let buf = bufadd('XsomeFile') |