]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(syntax-tests): Add :help command termination tests
authorDoug Kearns <dougkearns@gmail.com>
Sun, 11 Jan 2026 18:25:38 +0000 (18:25 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 11 Jan 2026 18:25:38 +0000 (18:25 +0000)
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>
.gitattributes
runtime/syntax/generator/vim.vim.base
runtime/syntax/testdir/dumps/vim_ex_help_00.dump
runtime/syntax/testdir/dumps/vim_ex_help_01.dump
runtime/syntax/testdir/dumps/vim_ex_help_02.dump
runtime/syntax/testdir/dumps/vim_ex_help_03.dump
runtime/syntax/testdir/input/vim_ex_help.vim
runtime/syntax/vim.vim
src/testdir/test_help.vim

index 46ac5f9cc67946889cb00b6b8c18112f51f1f238..695eaaa6d634ec2650dad4f2a11243b3e7965c42 100644 (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
index 754ddb0539772c0f1304319b4186097cb6ccc6cd..ecb0b5c0247c5379dfefc9779925b9512f30bf7e 100644 (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
index 24f30e6877f70e4f7f5e767302b945bfb8b497d5..c7401475188cc59701769d0551206f27ada425b9 100644 (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| 
index 206d8a5af94bfd61ca60bfb0e06ec3ead8c7b75e..82350a74de83c155fa5e8e306bba3d47ff462018 100644 (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|%| 
index f4a0374a4fea6a021aa9a76b7d3fc4b053aac5f6..392120ace3d7ef457fbc8a4b51a6d74063bc1d7a 100644 (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|%| 
index 4a9e7a90c4a42199704598396de696cc38d571bf..1cce14f6e020cecd10956d3027d196354cca1c32 100644 (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| 
index 4d13f3202f9d1e52def1093919051966d1f9d876..c673fe6b0a40ce3fad9521f31449b2db807ac13b 100644 (file)
Binary files a/runtime/syntax/testdir/input/vim_ex_help.vim and b/runtime/syntax/testdir/input/vim_ex_help.vim differ
index 27d15872cb9b5fc698f37e49b095d4ddc79f479f..7f6c38e01172c3aa9ebf6815ac642cf534ffbac6 100644 (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
index 33e5234b525d286536b7f3a7f3a0024eeb576068..df2b0c0abc7bbbfd73024ab957eda829d4c8a8ab 100644 (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