runtime(syntax-tests): Add :help command termination tests

Problem:  The :help command lacks command termination tests.
Solution: Add tests for command termination at "|", "^M" and "^J".

- Check special handling of "|" in arguments.
- Update the Vim syntax file.

closes: #18932

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Doug Kearns
2026-01-11 18:25:38 +00:00
committed by Christian Brabandt
parent 1e54023673
commit c4dc4d8f1e
9 changed files with 83 additions and 41 deletions

2
.gitattributes vendored
View File

@@ -38,3 +38,5 @@ src/po/vim.pot diff=ignore_vim_pot
#
# https://docs.github.com/en/repositories/working-with-files/managing-files/customizing-how-changed-files-appear-on-github
src/po/vim.pot linguist-generated=true
runtime/syntax/testdir/input/vim_ex_help.vim -text diff linguist-language=vim linguist-detectable=true

View File

@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
" Last Change: 2025 Dec 04
" Last Change: 2026 Jan 11
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -1462,10 +1462,10 @@ syn match vimHelp "\<h\%[elp]\>" skipwhite nextgroup=vimHelpBang,vimHelpArg,vimH
syn region vimHelpArg contained
\ start="\S"
\ matchgroup=Special
\ end="\%(@\a\a\)\=\ze\s*\%($\|\%x0d\|\%x00\||\s*\S\)"
\ end="\%(@\a\a\)\=\ze\s*\%($\|\%x0d\|\%x00\||[^|]\)"
\ oneline
syn match vimHelpNextCommand contained "\ze|[^|]" skipwhite nextgroup=vimCmdSep
syn match vimHelpBang contained "\a\@1<=!" skipwhite nextgroup=vimHelpArg,vimHelpNextCommand
syn match vimHelpNextCommand contained "\ze|\s*\S" skipwhite nextgroup=vimCmdSep
syn match vimHelpgrep "\<l\=helpg\%[rep]\>" skipwhite nextgroup=vimHelpgrepBang,vimHelpgrepPattern
syn region vimHelpgrepPattern contained

View File

@@ -1,20 +1,20 @@
>"+0#0000e05#ffffff0| |V|i|m| |:|h|e|l|p| |c|o|m@1|a|n|d| +0#0000000&@55
|"+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i| |l|i|n|k| |v|i|m|H|e|l|p|A|r|g| |T|o|d|o| +0#0000000&@34
|"+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i| |l|i|n|k| |v|i|m|C|m|d|S|e|p| |S|p|e|c|i|a|l| +0#0000000&@32
@75
@75
|h+0#af5f00255&|e|l|p| +0#0000000&@70
|h+0#af5f00255&|e|l|p|!| +0#0000000&||| |"+0#0000e05&| |E|4|7|8|:| |D|o|n|'|t| |p|a|n|i|c|!| +0#0000000&@46
|h+0#af5f00255&|e|l|p|!| +0#0000000&||+0#e000e06&| +0#0000000&|"+0#0000e05&| |E|4|7|8|:| |D|o|n|'|t| |p|a|n|i|c|!| +0#0000000&@46
|h+0#af5f00255&|e|l|p| +0#0000000&@1|h+0#0000001#ffff4012|e|l|p|h|e|l|p| +0#0000000#ffffff0@60
|h+0#af5f00255&|e|l|p|!| +0#0000000&|h+0#0000001#ffff4012|e|l|p|h|e|l|p| +0#0000000#ffffff0@60
@75
@75
|"+0#0000e05&| |w|h|i|t|e|s|p|a|c|e| |a|l@1|o|w|e|d| +0#0000000&@54
@75
|h+0#af5f00255&|e|l|p| +0#0000000&@1|f+0#0000001#ffff4012|o@1| |b|a|r| +0#0000000#ffffff0||| |"+0#0000e05&| |E|1|4|9|:| |S|o|r@1|y|,| |n|o| |h|e|l|p| |f|o|r| |f|o@1| |b|a|r| +0#0000000&@24
|h+0#af5f00255&|e|l|p|!| +0#0000000&|f+0#0000001#ffff4012|o@1| |b|a|r| +0#0000000#ffffff0||| |"+0#0000e05&| |E|1|4|9|:| |S|o|r@1|y|,| |n|o| |h|e|l|p| |f|o|r| |f|o@1| |b|a|r| +0#0000000&@24
|h+0#af5f00255&|e|l|p| +0#0000000&@1|f+0#0000001#ffff4012|o@1| |b|a|r| +0#0000000#ffffff0||+0#e000e06&| +0#0000000&|"+0#0000e05&| |E|1|4|9|:| |S|o|r@1|y|,| |n|o| |h|e|l|p| |f|o|r| |f|o@1| |b|a|r| +0#0000000&@24
|h+0#af5f00255&|e|l|p|!| +0#0000000&|f+0#0000001#ffff4012|o@1| |b|a|r| +0#0000000#ffffff0||+0#e000e06&| +0#0000000&|"+0#0000e05&| |E|1|4|9|:| |S|o|r@1|y|,| |n|o| |h|e|l|p| |f|o|r| |f|o@1| |b|a|r| +0#0000000&@24
@75
|"+0#0000e05&| |a|n|y| |c|h|a|r|a|c|t|e|r|s| +0#0000000&@58
@75
|h+0#af5f00255&|e|l|p| +0#0000000&|!+0#0000001#ffff4012|@|#|$|%|^|&|*|(|)|_|+| +0#0000000#ffffff0@57
|h+0#af5f00255&|e|l|p|!|@+0#0000001#ffff4012|#|$|%|^|&|*|(|)|_|+| +0#0000000#ffffff0@58
@57|1|,|1| @10|T|o|p|

View File

@@ -1,20 +1,20 @@
|h+0#af5f00255#ffffff0|e|l|p|!| +0#0000000&|f+0#0000001#ffff4012|o@1| |b|a|r| +0#0000000#ffffff0||| |"+0#0000e05&| |E|1|4|9|:| |S|o|r@1|y|,| |n|o| |h|e|l|p| |f|o|r| |f|o@1| |b|a|r| +0#0000000&@24
|h+0#af5f00255#ffffff0|e|l|p| +0#0000000&@1|f+0#0000001#ffff4012|o@1| |b|a|r| +0#0000000#ffffff0||+0#e000e06&| +0#0000000&|"+0#0000e05&| |E|1|4|9|:| |S|o|r@1|y|,| |n|o| |h|e|l|p| |f|o|r| |f|o@1| |b|a|r| +0#0000000&@24
|h+0#af5f00255&|e|l|p|!| +0#0000000&|f+0#0000001#ffff4012|o@1| |b|a|r| +0#0000000#ffffff0||+0#e000e06&| +0#0000000&|"+0#0000e05&| |E|1|4|9|:| |S|o|r@1|y|,| |n|o| |h|e|l|p| |f|o|r| |f|o@1| |b|a|r| +0#0000000&@24
@75
|"+0#0000e05&| |a|n|y| |c|h|a|r|a|c|t|e|r|s| +0#0000000&@58
@75
|h+0#af5f00255&|e|l|p| +0#0000000&|!+0#0000001#ffff4012|@|#|$|%|^|&|*|(|)|_|+| +0#0000000#ffffff0@57
>h+0#af5f00255&|e|l|p|!|@+0#0000001#ffff4012|#|$|%|^|&|*|(|)|_|+| +0#0000000#ffffff0@58
>h+0#af5f00255&|e|l|p| +0#0000000&|!+0#0000001#ffff4012|@|#|$|%|^|&|*|(|)|_|+| +0#0000000#ffffff0@57
|h+0#af5f00255&|e|l|p|!|@+0#0000001#ffff4012|#|$|%|^|&|*|(|)|_|+| +0#0000000#ffffff0@58
|h+0#af5f00255&|e|l|p| +0#0000000&|@+0#0000001#ffff4012|#|$|%|^|&|*|(|)|_|+| +0#0000000#ffffff0@58
|h+0#af5f00255&|e|l|p|@+0#0000001#ffff4012|#|$|%|^|&|*|(|)|_|+| +0#0000000#ffffff0@59
@75
@75
|"+0#0000e05&| |c|o|m@1|a|n|d| |s|e|p|a|r|a|t|o|r|s| +0#0000000&@54
@75
|h+0#af5f00255&|e|l|p||+0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@59
|h+0#af5f00255&|e|l|p||+0#0000000&| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@58
|h+0#af5f00255&|e|l|p| +0#0000000&|||e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@58
|h+0#af5f00255&|e|l|p| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@57
|h+0#af5f00255&|e|l|p||+0#e000e06&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@59
|h+0#af5f00255&|e|l|p||+0#e000e06&| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@58
|h+0#af5f00255&|e|l|p| +0#0000000&||+0#e000e06&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@58
|h+0#af5f00255&|e|l|p| +0#0000000&||+0#e000e06&| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@57
@75
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1||+0#0000000#ffffff0| @1|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@53
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|^+0#0000e05#ffffff0|@| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@53
@57|1|9|,|1| @9|3|7|%|
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1||+0#e000e06#ffffff0| +0#0000000&@1|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@53
@57|1|9|,|1| @9|2|9|%|

View File

@@ -1,20 +1,20 @@
|h+0#af5f00255#ffffff0|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|^+0#0000e05#ffffff0|@| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@53
|h+0#af5f00255#ffffff0|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1||+0#e000e06#ffffff0| +0#0000000&@1|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@53
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|^+0#0000e05#ffffff0|@| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@53
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|^+0#0000e05#ffffff0|M| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@53
@75
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0||| @1|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@52
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0|^+0#0000e05&|@| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@52
>h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0|^+0#0000e05&|M| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@52
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0||+0#e000e06&| +0#0000000&@1|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@52
>h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0|^+0#0000e05&|@| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@52
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0|^+0#0000e05&|M| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@52
@75
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1||+0#0000000#ffffff0|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@55
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1||+0#e000e06#ffffff0|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@55
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|^+0#0000e05#ffffff0|@|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@54
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|^+0#0000e05#ffffff0|M|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@54
@75
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n||+0#0000000&| @1|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@50
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n||| +0#0000000&@1|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@50
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n|^+0#0000e05&|@| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@50
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n|^+0#0000e05&|M| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@50
@75
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n| +0#0000000&||| @1|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@49
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n| +0#0000000&||+0#e000e06&| +0#0000000&@1|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@49
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n| +0#0000000&|^+0#0000e05&|@| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@49
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n| +0#0000000&|^+0#0000e05&|M| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@49
@75
@57|3|7|,|1| @9|8@1|%|
@57|3|7|,|1| @9|7|0|%|

View File

@@ -1,20 +1,20 @@
| +0&#ffffff0@74
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n||+0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@52
|h+0#af5f00255#ffffff0|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n| +0#0000000&|^+0#0000e05&|M| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@49
@75
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n|||e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@52
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n|^+0#0000e05&|@|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@51
|h+0#af5f00255&|e|l|p| +0#0000000&|f+0#0000001#ffff4012|o@1|@+0#e000e06#ffffff0|e|n|^+0#0000e05&|M|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@51
> @74
|h+0#af5f00255&|e|l|p| +0#0000000&||+0#0000001#ffff4012| +0#0000000#ffffff0@68
|h+0#af5f00255&|e|l|p| +0#0000000&||+0#0000001#ffff4012@1| +0#0000000#ffffff0@67
|h+0#af5f00255&|e|l|p| +0#0000000&||+0#0000001#ffff4012@2| +0#0000000#ffffff0@66
|"+0#0000e05&| |e|m|p|t|y| |n|e|x|t| |c|o|m@1|a|n|d| |(|t|r|a|i|l|i|n|g| |w|h|i|t|e|s|p|a|c|e|)| +0#0000000&@32
|h+0#af5f00255&|e|l|p| +0#0000000&||+0#e000e06&| +0#0000000&@68
|h+0#af5f00255&|e|l|p| +0#0000000&||+0#0000001#ffff4012||+0#e000e06#ffffff0| +0#0000000&@67
|h+0#af5f00255&|e|l|p| +0#0000000&||+0#0000001#ffff4012@1||+0#e000e06#ffffff0| +0#0000000&@66
@75
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
| +0#0000000&@56|5|4|,|0|-|1| @7|B|o|t|
| +0#0000000&@56|5@1|,|0|-|1| @7|B|o|t|

View File

@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
" Last Change: 2025 Dec 13
" Last Change: 2026 Jan 11
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -1521,10 +1521,10 @@ syn match vimHelp "\<h\%[elp]\>" skipwhite nextgroup=vimHelpBang,vimHelpArg,vimH
syn region vimHelpArg contained
\ start="\S"
\ matchgroup=Special
\ end="\%(@\a\a\)\=\ze\s*\%($\|\%x0d\|\%x00\||\s*\S\)"
\ end="\%(@\a\a\)\=\ze\s*\%($\|\%x0d\|\%x00\||[^|]\)"
\ oneline
syn match vimHelpNextCommand contained "\ze|[^|]" skipwhite nextgroup=vimCmdSep
syn match vimHelpBang contained "\a\@1<=!" skipwhite nextgroup=vimHelpArg,vimHelpNextCommand
syn match vimHelpNextCommand contained "\ze|\s*\S" skipwhite nextgroup=vimCmdSep
syn match vimHelpgrep "\<l\=helpg\%[rep]\>" skipwhite nextgroup=vimHelpgrepBang,vimHelpgrepPattern
syn region vimHelpgrepPattern contained

View File

@@ -234,5 +234,45 @@ func Test_helptag_navigation()
bw
endfunc
func Test_help_command_termination()
" :help {arg}
call execute('help |')
call assert_match('*bar\*', getline('.'))
" :help {arg}
call execute('help ||')
call assert_match('*expr-barbar\*', getline('.'))
" :help | <whitespace> <empty-command>
call execute('help | ')
call assert_match('*help.txt\*', getline('.'))
" :help {arg} | <whitespace> <empty-command>
call execute('help || ')
call assert_match('*bar\*', getline('.'))
" :help {arg}
call assert_fails('help |||', 'E149:')
" :help {arg} | <whitespace> <empty-command>
call execute('help ||| ')
call assert_match('*expr-barbar\*', getline('.'))
" :help {invalid-arg}
call assert_fails('help ||||', 'E149:')
" :help {invalid-arg} | <whitespace> <empty-command>
" (aborted command sequence)
call assert_fails('help |||| ', 'E149:')
call assert_equal("nextcmd",
\ execute("help | echo 'nextcmd'")->split("\n")[-1])
call assert_equal("nextcmd",
\ execute("help || echo 'nextcmd'")->split("\n")[-1])
call assert_equal("nextcmd",
\ execute("help \<NL> echo 'nextcmd'")->split("\n")[-1])
call assert_equal("nextcmd",
\ execute("help \<CR> echo 'nextcmd'")->split("\n")[-1])
helpclose
endfunc
" vim: shiftwidth=2 sts=2 expandtab