0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

patch 9.0.0713: <amatch> of MenuPopup event is expanded like a file name

Problem:    <amatch> of MenuPopup event is expanded like a file name.
Solution:   Do not expand <amatch> for MenuPopup. (closes #11328)
This commit is contained in:
zeertzjq
2022-10-10 13:46:15 +01:00
committed by Bram Moolenaar
parent 79f234499b
commit c601d988b6
3 changed files with 32 additions and 0 deletions

View File

@@ -2095,6 +2095,7 @@ apply_autocmds_group(
|| event == EVENT_DIRCHANGED || event == EVENT_DIRCHANGED
|| event == EVENT_DIRCHANGEDPRE || event == EVENT_DIRCHANGEDPRE
|| event == EVENT_MODECHANGED || event == EVENT_MODECHANGED
|| event == EVENT_MENUPOPUP
|| event == EVENT_USER || event == EVENT_USER
|| event == EVENT_WINCLOSED || event == EVENT_WINCLOSED
|| event == EVENT_WINSCROLLED) || event == EVENT_WINSCROLLED)

View File

@@ -479,6 +479,35 @@ func Test_popup_menu()
unmenu PopUp unmenu PopUp
endfunc 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 " Test for listing the menus using the :menu command
func Test_show_menus() func Test_show_menus()
" In the GUI, tear-off menu items are present in the output below " In the GUI, tear-off menu items are present in the output below

View File

@@ -699,6 +699,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
713,
/**/ /**/
712, 712,
/**/ /**/