Patch 9.0.0713
Problem:    <amatch> of MenuPopup event is expanded like a file name.
Solution:   Do not expand <amatch> for MenuPopup. (closes #11328)
Files:      src/autocmd.c, src/testdir/test_menu.vim


*** ../vim-9.0.0712/src/autocmd.c       2022-09-24 11:30:38.373605018 +0100
--- src/autocmd.c       2022-10-10 13:43:50.508941603 +0100
***************
*** 2095,2100 ****
--- 2095,2101 ----
                || event == EVENT_DIRCHANGED
                || event == EVENT_DIRCHANGEDPRE
                || event == EVENT_MODECHANGED
+               || event == EVENT_MENUPOPUP
                || event == EVENT_USER
                || event == EVENT_WINCLOSED
                || event == EVENT_WINSCROLLED)
*** ../vim-9.0.0712/src/testdir/test_menu.vim   2022-08-05 10:52:27.444080680 
+0100
--- src/testdir/test_menu.vim   2022-10-10 13:43:50.508941603 +0100
***************
*** 479,484 ****
--- 479,513 ----
    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
*** ../vim-9.0.0712/src/version.c       2022-10-10 12:42:52.476239815 +0100
--- src/version.c       2022-10-10 13:45:35.385103038 +0100
***************
*** 701,702 ****
--- 701,704 ----
  {   /* Add new patch number below this line */
+ /**/
+     713,
  /**/

-- 
A mathematician is a device for turning coffee into theorems.
                                        Paul Erdos
A computer programmer is a device for turning coffee into bugs.
                                        Bram Moolenaar

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20221010124704.B4C3A1C529A%40moolenaar.net.

Raspunde prin e-mail lui