diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-10-10 13:46:15 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-10-10 13:46:15 +0100 |
commit | c601d988b6b1a672f71e3d61f4aaa4f7742a3a21 (patch) | |
tree | 21863b5e9bc335c7930aaa1990fa6c188bc582b1 /src/testdir/test_menu.vim | |
parent | 79f234499b6692cc16970b7455bc9b002242632f (diff) |
patch 9.0.0713: <amatch> of MenuPopup event is expanded like a file namev9.0.0713
Problem: <amatch> of MenuPopup event is expanded like a file name.
Solution: Do not expand <amatch> for MenuPopup. (closes #11328)
Diffstat (limited to 'src/testdir/test_menu.vim')
-rw-r--r-- | src/testdir/test_menu.vim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/testdir/test_menu.vim b/src/testdir/test_menu.vim index 1602e93de6..95d2b01a5c 100644 --- a/src/testdir/test_menu.vim +++ b/src/testdir/test_menu.vim @@ -479,6 +479,35 @@ func Test_popup_menu() unmenu PopUp endfunc +" Test for MenuPopup autocommand +func Test_autocmd_MenuPopup() + CheckNotGui + + set mouse=a + set mousemodel=popup + aunmenu * + autocmd MenuPopup * exe printf( + \ 'anoremenu PopUp.Foo <Cmd>let g:res = ["%s", "%s"]<CR>', + \ expand('<afile>'), expand('<amatch>')) + + call feedkeys("\<RightMouse>\<Down>\<CR>", 'tnix') + call assert_equal(['n', 'n'], g:res) + + call feedkeys("v\<RightMouse>\<Down>\<CR>\<Esc>", 'tnix') + call assert_equal(['v', 'v'], g:res) + + call feedkeys("gh\<RightMouse>\<Down>\<CR>\<Esc>", 'tnix') + call assert_equal(['s', 's'], g:res) + + call feedkeys("i\<RightMouse>\<Down>\<CR>\<Esc>", 'tnix') + call assert_equal(['i', 'i'], g:res) + + autocmd! MenuPopup + aunmenu PopUp.Foo + unlet g:res + set mouse& mousemodel& +endfunc + " Test for listing the menus using the :menu command func Test_show_menus() " In the GUI, tear-off menu items are present in the output below |