summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkearns <dougkearns@gmail.com>2024-03-20 04:04:42 +1100
committerGitHub <noreply@github.com>2024-03-19 18:04:42 +0100
commitec21bafc135a1e78d40e4fc9118e022bbab958e8 (patch)
tree85cbf9638fe63e39f2b11b78b2e39e4fc7e0c0ac
parent702f7923f6e57051b314e26fde6734dfb1292da7 (diff)
runtime(vim): Update base-syntax, disallow '.' at start of menu item names (#14232)
Disallow '.' at the start of a menu item name. This is the menu path separator character and should be escaped with a '\' in this case. Partially fixes #14230. "popup" is still incorrectly matched as the Ex command. Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--runtime/syntax/generator/vim.vim.base6
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_menu_01.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_menu_02.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_menu_03.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_menu_04.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_menu_99.dump32
-rw-r--r--runtime/syntax/testdir/input/vim_ex_menu.vim14
-rw-r--r--runtime/syntax/vim.vim6
8 files changed, 59 insertions, 25 deletions
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index 6527be4254..46285f3dba 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -3,7 +3,7 @@
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
" URL: https://github.com/vim-jp/syntax-vim-ex
-" Last Change: 2024 Mar 18
+" Last Change: 2024 Mar 19
" Former Maintainer: Charles E. Campbell
" Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
" Base File Version: 9.0-25
@@ -498,8 +498,8 @@ syn case match
syn keyword vimMenu popu[p] skipwhite nextgroup=vimMenuBang,vimMenuName
syn region vimMenuRhs contained contains=@vimContinue,vimNotation start="|\@!\S" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + end="$" matchgroup=vimSep end="|"
syn region vimMenuRhsContinue contained contains=@vimContinue,vimNotation start=+^\s*\%(\\\|"\\ \)+ skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + end="$" matchgroup=vimSep end="|"
-syn match vimMenuName "\%(\\\s\|\S\)\+" contained contains=vimMenuNotation,vimNotation skipwhite nextgroup=vimCmdSep,vimMenuRhs
-syn match vimMenuName "\%(\\\s\|\S\)\+\ze\s*$" contained contains=vimMenuNotation,vimNotation skipwhite skipnl nextgroup=vimCmdSep,vimMenuRhsContinue
+syn match vimMenuName "\.\@!\%(\\\s\|\S\)\+" contained contains=vimMenuNotation,vimNotation skipwhite nextgroup=vimCmdSep,vimMenuRhs
+syn match vimMenuName "\.\@!\%(\\\s\|\S\)\+\ze\s*$" contained contains=vimMenuNotation,vimNotation skipwhite skipnl nextgroup=vimCmdSep,vimMenuRhsContinue
syn match vimMenuNotation "&\a\|&&\|\\\s\|\\\." contained
syn match vimMenuPriority "\<\d\+\%(\.\d\+\)*\>" contained skipwhite nextgroup=vimMenuName
syn match vimMenuMod "\c<\%(script\|silent\|special\)>" contained skipwhite nextgroup=vimMenuName,vimMenuPriority,vimMenuMod contains=vimMapModKey,vimMapModErr
diff --git a/runtime/syntax/testdir/dumps/vim_ex_menu_01.dump b/runtime/syntax/testdir/dumps/vim_ex_menu_01.dump
index 9b0d5cfc38..9b60b2a128 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_menu_01.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_menu_01.dump
@@ -17,4 +17,4 @@
@75
|"+0#0000e05&| +0#0000000&|E+0#e000e06&|x|a|m|p|l|e|:| +0#0000e05&|r|u|n|t|i|m|e|/|m|e|n|u|.|v|i|m| |(|m|o|d|i|f|i|e|d|)| +0#0000000&@36
|a+0#af5f00255&|n| +0#0000000&|<+0#e000e06&|s|i|l|e|n|t|>| +0#0000000&|1+0#e000002&|0|.|3@1|0| +0#0000000&|&+0#e000e06&|F|i|l|e|.|&|C|l|o|s|e|<|T|a|b|>|:|c|l|o|s|e| +0#0000000&|:|c|o|n|f|i|r|m| |c|l|o|s|e|<+0#e000e06&|C|R|>| +0#0000000&@13
-@57|1|9|,|1| @9|2|4|%|
+@57|1|9|,|1| @9|1|9|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_menu_02.dump b/runtime/syntax/testdir/dumps/vim_ex_menu_02.dump
index 8e5f1b886f..a5c1acf071 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_menu_02.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_menu_02.dump
@@ -17,4 +17,4 @@
@8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
@8|\+0#e000e06&| +0#0000000&@2|c|o|n|f|i|r|m| |c|l|o|s|e| |<+0#e000e06&|B|a|r|>| +0#0000000&@43
@8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
-@57|3|7|,|2|-|9| @7|5|7|%|
+@57|3|7|,|2|-|9| @7|4|5|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_menu_03.dump b/runtime/syntax/testdir/dumps/vim_ex_menu_03.dump
index 671e6c7c36..2ef89ec4ca 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_menu_03.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_menu_03.dump
@@ -17,4 +17,4 @@
@8|\+0#e000e06&| +0#0000000&@2|c|o|n|f|i|r|m| |c|l|o|s|e| |<+0#e000e06&|B|a|r|>| +0#0000000&@43
@8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
@8|\+0#e000e06&| +0#0000000&|e|n|d|i|f|<+0#e000e06&|C|R|>| +0#0000000&@55
-@57|5@1|,|2|-|9| @7|8|9|%|
+@57|5@1|,|2|-|9| @7|7|1|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_menu_04.dump b/runtime/syntax/testdir/dumps/vim_ex_menu_04.dump
new file mode 100644
index 0000000000..ad079e640b
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_menu_04.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@74
+@75
+|"+0#0000e05&| |p|o|p|u|p| |m|e|n|u|s| +0#0000000&@61
+|p+0#af5f00255&|o|p|u|p| +0#0000000&|&+0#e000e06&|F|o@1| +0#0000000&@1||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@50
+|p+0#af5f00255&|o|p|u|p|!| +0#0000000&|&+0#e000e06&|F|o@1| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@50
+> @74
+@75
+|"+0#0000e05&| |I|s@1|u|e| |#|1|4|2|3|0| +0#0000000&@60
+@75
+|"+0#0000e05&| |a| |m|e|n|u| |i|t|e|m| |n|a|m|e| |c|a|n@1|o|t| |s|t|a|r|t| |w|i|t|h| |'|.|'| +0#0000000&@34
+@75
+|e+0#af5f00255&|x|p|o|r|t| +0#0000000&|d+0#af5f00255&|e|f| +0#0000000&|H|i|s|t|o|r|y|J|u|m|p|M|e|n|u|(+0#e000e06&|)| +0#0000000&@46
+@4|p+0#af5f00255&|o|p|u|p|.|F+0#0000000&|i|l|t|e|r|M|e|n|u|(+0#e000e06&|"+0#e000002&|J|u|m|p| |h|i|s|t|o|r|y|"|,+0#0000000&| |d+0#00e0e07&|i|r|_|h|i|s|t|,+0#0000000&| @28
+@8|(+0#e000e06&|r+0#00e0e07&|e|s|,+0#0000000&| |_+0#00e0e07&|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|{+0#e000e06&| +0#0000000&@53
+@12|H|i|s|t|o|r|y|J|u|m|p|(+0#e000e06&|r+0#00e0e07&|e|s|.+0#af5f00255&|t+0#00e0e07&|e|x|t|)+0#e000e06&| +0#0000000&@41
+@8|}+0#e000e06&|)| +0#0000000&@64
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|p+0#af5f00255&|o|p|u|p|\+0#e000e06&|.|F|i|l|t|e|r|M|e|n|u|<|T|a|b|>|F|i|l|t|e|r|(|)|<|C|R|>| +0#0000000&@40
+@57|7|3|,|0|-|1| @7|9|8|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_menu_99.dump b/runtime/syntax/testdir/dumps/vim_ex_menu_99.dump
index 7721e4a98e..80608b7469 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_menu_99.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_menu_99.dump
@@ -1,20 +1,20 @@
-| +0&#ffffff0@7|\+0#e000e06&| +0#0000000&@2|c|o|n|f|i|r|m| |c|l|o|s|e| |<+0#e000e06&|B|a|r|>| +0#0000000&@43
-@8|\+0#e000e06&| +0#0000000&|e|n|d|i|f|<+0#e000e06&|C|R|>| +0#0000000&@55
-@75
-|a+0#af5f00255&|n| +0#0000000&|<+0#e000e06&|s|i|l|e|n|t|>| +0#0000000&|1+0#e000002&|0|.|3@1|0| +0#0000000&|&+0#e000e06&|F|i|l|e|.|&|C|l|o|s|e|<|T|a|b|>|:|c|l|o|s|e| +0#0000000&|:|i|f| |w|i|n|h|e|i|g|h|t|(|2|)| |<| |0| |&@1| |t|a|b|p|a|g|e|w
-|i|n@1|r|(|2|)| |=@1| |0| |<+0#e000e06&|B|a|r|>| +0#0000000&@56
-@8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
-@8|\+0#e000e06&| +0#0000000&@2|c|o|n|f|i|r|m| |e|n|e|w| |<+0#e000e06&|B|a|r|>| +0#0000000&@44
-@8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
-@8|\+0#e000e06&| +0#0000000&|e|l|s|e| |<+0#e000e06&|B|a|r|>| +0#0000000&@54
-@8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
-@8|\+0#e000e06&| +0#0000000&@2|c|o|n|f|i|r|m| |c|l|o|s|e| |<+0#e000e06&|B|a|r|>| +0#0000000&@43
-@8|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@56
-@8|\+0#e000e06&| +0#0000000&|e|n|d|i|f|<+0#e000e06&|C|R|>| +0#0000000&@55
-@75
-@75
+| +0&#ffffff0@74
|"+0#0000e05&| |p|o|p|u|p| |m|e|n|u|s| +0#0000000&@61
|p+0#af5f00255&|o|p|u|p| +0#0000000&|&+0#e000e06&|F|o@1| +0#0000000&@1||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@50
|p+0#af5f00255&|o|p|u|p|!| +0#0000000&|&+0#e000e06&|F|o@1| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@50
+@75
+@75
+|"+0#0000e05&| |I|s@1|u|e| |#|1|4|2|3|0| +0#0000000&@60
+@75
+|"+0#0000e05&| |a| |m|e|n|u| |i|t|e|m| |n|a|m|e| |c|a|n@1|o|t| |s|t|a|r|t| |w|i|t|h| |'|.|'| +0#0000000&@34
+@75
+|e+0#af5f00255&|x|p|o|r|t| +0#0000000&|d+0#af5f00255&|e|f| +0#0000000&|H|i|s|t|o|r|y|J|u|m|p|M|e|n|u|(+0#e000e06&|)| +0#0000000&@46
+@4|p+0#af5f00255&|o|p|u|p|.|F+0#0000000&|i|l|t|e|r|M|e|n|u|(+0#e000e06&|"+0#e000002&|J|u|m|p| |h|i|s|t|o|r|y|"|,+0#0000000&| |d+0#00e0e07&|i|r|_|h|i|s|t|,+0#0000000&| @28
+@8|(+0#e000e06&|r+0#00e0e07&|e|s|,+0#0000000&| |_+0#00e0e07&|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|{+0#e000e06&| +0#0000000&@53
+@12|H|i|s|t|o|r|y|J|u|m|p|(+0#e000e06&|r+0#00e0e07&|e|s|.+0#af5f00255&|t+0#00e0e07&|e|x|t|)+0#e000e06&| +0#0000000&@41
+@8|}+0#e000e06&|)| +0#0000000&@64
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|p+0#af5f00255&|o|p|u|p|\+0#e000e06&|.|F|i|l|t|e|r|M|e|n|u|<|T|a|b|>|F|i|l|t|e|r|(|)|<|C|R|>| +0#0000000&@40
> @74
-@57|7|3|,|0|-|1| @7|B|o|t|
+@57|8|7|,|0|-|1| @7|B|o|t|
diff --git a/runtime/syntax/testdir/input/vim_ex_menu.vim b/runtime/syntax/testdir/input/vim_ex_menu.vim
index da10a110e4..fb737c2c2f 100644
--- a/runtime/syntax/testdir/input/vim_ex_menu.vim
+++ b/runtime/syntax/testdir/input/vim_ex_menu.vim
@@ -71,3 +71,17 @@ an <silent> 10.330 &File.&Close<Tab>:close :if winheight(2) < 0 && tabpagewinnr(
popup &Foo | echo "Foo"
popup! &Foo | echo "Foo"
+
+" Issue #14230
+
+" a menu item name cannot start with '.'
+
+export def HistoryJumpMenu()
+ popup.FilterMenu("Jump history", dir_hist,
+ (res, _) => {
+ HistoryJump(res.text)
+ })
+enddef
+
+popup\.FilterMenu<Tab>Filter()<CR>
+
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 95d55b99d0..db15df6c5e 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -3,7 +3,7 @@
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
" URL: https://github.com/vim-jp/syntax-vim-ex
-" Last Change: 2024 Mar 18
+" Last Change: 2024 Mar 19
" Former Maintainer: Charles E. Campbell
" Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
" Base File Version: 9.0-25
@@ -542,8 +542,8 @@ syn keyword vimMenu am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu]
syn keyword vimMenu popu[p] skipwhite nextgroup=vimMenuBang,vimMenuName
syn region vimMenuRhs contained contains=@vimContinue,vimNotation start="|\@!\S" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + end="$" matchgroup=vimSep end="|"
syn region vimMenuRhsContinue contained contains=@vimContinue,vimNotation start=+^\s*\%(\\\|"\\ \)+ skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + end="$" matchgroup=vimSep end="|"
-syn match vimMenuName "\%(\\\s\|\S\)\+" contained contains=vimMenuNotation,vimNotation skipwhite nextgroup=vimCmdSep,vimMenuRhs
-syn match vimMenuName "\%(\\\s\|\S\)\+\ze\s*$" contained contains=vimMenuNotation,vimNotation skipwhite skipnl nextgroup=vimCmdSep,vimMenuRhsContinue
+syn match vimMenuName "\.\@!\%(\\\s\|\S\)\+" contained contains=vimMenuNotation,vimNotation skipwhite nextgroup=vimCmdSep,vimMenuRhs
+syn match vimMenuName "\.\@!\%(\\\s\|\S\)\+\ze\s*$" contained contains=vimMenuNotation,vimNotation skipwhite skipnl nextgroup=vimCmdSep,vimMenuRhsContinue
syn match vimMenuNotation "&\a\|&&\|\\\s\|\\\." contained
syn match vimMenuPriority "\<\d\+\%(\.\d\+\)*\>" contained skipwhite nextgroup=vimMenuName
syn match vimMenuMod "\c<\%(script\|silent\|special\)>" contained skipwhite nextgroup=vimMenuName,vimMenuPriority,vimMenuMod contains=vimMapModKey,vimMapModErr