comparison src/testdir/test_popupwin.vim @ 18544:a6dbbedddce1 v8.1.2266

patch 8.1.2266: position unknown for a mouse click in a popup window Commit: https://github.com/vim/vim/commit/f8b036bcae27014e4cbbdceec262b0a4c6dc2d9c Author: Bram Moolenaar <Bram@vim.org> Date: Wed Nov 6 21:09:17 2019 +0100 patch 8.1.2266: position unknown for a mouse click in a popup window Problem: Position unknown for a mouse click in a popup window. Solution: Set v:mouse_col and v:mouse_lnum. (closes https://github.com/vim/vim/issues/5171)
author Bram Moolenaar <Bram@vim.org>
date Wed, 06 Nov 2019 21:15:03 +0100
parents 244b336b94ce
children e5ef5d820b5b
comparison
equal deleted inserted replaced
18543:5a689444b598 18544:a6dbbedddce1
2164 2164
2165 call popup_close(winid) 2165 call popup_close(winid)
2166 delfunc MyPopupFilter 2166 delfunc MyPopupFilter
2167 endfunc 2167 endfunc
2168 2168
2169 func Test_popupwin_filter_mouse()
2170 func MyPopupFilter(winid, c)
2171 let g:got_mouse_col = v:mouse_col
2172 let g:got_mouse_lnum = v:mouse_lnum
2173 return 0
2174 endfunc
2175
2176 let winid = popup_create(['short', 'long line that will wrap', 'short'], #{
2177 \ line: 4,
2178 \ col: 8,
2179 \ maxwidth: 12,
2180 \ filter: 'MyPopupFilter',
2181 \ })
2182 redraw
2183 call test_setmouse(4, 8)
2184 call feedkeys("\<LeftMouse>", 'xt')
2185 call assert_equal(1, g:got_mouse_col)
2186 call assert_equal(1, g:got_mouse_lnum)
2187
2188 call test_setmouse(5, 8)
2189 call feedkeys("\<LeftMouse>", 'xt')
2190 call assert_equal(1, g:got_mouse_col)
2191 call assert_equal(2, g:got_mouse_lnum)
2192
2193 call test_setmouse(6, 8)
2194 call feedkeys("\<LeftMouse>", 'xt')
2195 call assert_equal(13, g:got_mouse_col)
2196 call assert_equal(2, g:got_mouse_lnum)
2197
2198 call test_setmouse(7, 20)
2199 call feedkeys("\<LeftMouse>", 'xt')
2200 call assert_equal(13, g:got_mouse_col)
2201 call assert_equal(3, g:got_mouse_lnum)
2202
2203 call popup_close(winid)
2204 delfunc MyPopupFilter
2205 endfunc
2206
2169 func Test_popupwin_with_buffer() 2207 func Test_popupwin_with_buffer()
2170 call writefile(['some text', 'in a buffer'], 'XsomeFile') 2208 call writefile(['some text', 'in a buffer'], 'XsomeFile')
2171 let buf = bufadd('XsomeFile') 2209 let buf = bufadd('XsomeFile')
2172 call assert_equal(0, bufloaded(buf)) 2210 call assert_equal(0, bufloaded(buf))
2173 2211