aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-10 21:26:18 +0800
committerGitHub <noreply@github.com>2022-10-10 21:26:18 +0800
commit81058119dfa493aa7849b0ad125e9b1d79fb20b9 (patch)
tree448a663d206dd52701558f39a38e7ffe65c37bdf /src/nvim/testdir
parentd4e749f1b2358f12af3dd2481a0b9c36169cbeef (diff)
downloadrneovim-81058119dfa493aa7849b0ad125e9b1d79fb20b9.tar.gz
rneovim-81058119dfa493aa7849b0ad125e9b1d79fb20b9.tar.bz2
rneovim-81058119dfa493aa7849b0ad125e9b1d79fb20b9.zip
vim-patch:9.0.0713: <amatch> of MenuPopup event is expanded like a file name (#20572)
Problem: <amatch> of MenuPopup event is expanded like a file name. Solution: Do not expand <amatch> for MenuPopup. (closes vim/vim#11328) https://github.com/vim/vim/commit/c601d988b6b1a672f71e3d61f4aaa4f7742a3a21
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_menu.vim29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_menu.vim b/src/nvim/testdir/test_menu.vim
index 75992d3313..db7ec92bf8 100644
--- a/src/nvim/testdir/test_menu.vim
+++ b/src/nvim/testdir/test_menu.vim
@@ -481,6 +481,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