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

0 views
Skip to first unread message

Christian Brabandt

unread,
Jan 11, 2026, 1:31:17 PM (12 hours ago) Jan 11
to vim...@googlegroups.com
runtime(syntax-tests): Add :help command termination tests

Commit: https://github.com/vim/vim/commit/c4dc4d8f1eca8e3989c5f7770b062e3cf344a936
Author: Doug Kearns <dougk...@gmail.com>
Date: Sun Jan 11 18:25:38 2026 +0000

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 <dougk...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/.gitattributes b/.gitattributes
index 46ac5f9cc..695eaaa6d 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -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
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index 754ddb053..ecb0b5c02 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougk...@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="\%(@ \)\=\ze\s*\%($\|\%x0d\|\%x00\||\s*\S\)"
+ \ end="\%(@ \)\=\ze\s*\%($\|\%x0d\|\%x00\||[^|]\)"
\ oneline
+syn match vimHelpNextCommand contained "\ze|[^|]" skipwhite nextgroup=vimCmdSep
syn match vimHelpBang contained " \@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
diff --git a/runtime/syntax/testdir/dumps/vim_ex_help_00.dump b/runtime/syntax/testdir/dumps/vim_ex_help_00.dump
index 24f30e687..c74014751 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_help_00.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_help_00.dump
@@ -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|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_help_01.dump b/runtime/syntax/testdir/dumps/vim_ex_help_01.dump
index 206d8a5af..82350a74d 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_help_01.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_help_01.dump
@@ -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|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_help_02.dump b/runtime/syntax/testdir/dumps/vim_ex_help_02.dump
index f4a0374a4..392120ace 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_help_02.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_help_02.dump
@@ -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|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_help_03.dump b/runtime/syntax/testdir/dumps/vim_ex_help_03.dump
index 4a9e7a90c..1cce14f6e 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_help_03.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_help_03.dump
@@ -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|
diff --git a/runtime/syntax/testdir/input/vim_ex_help.vim b/runtime/syntax/testdir/input/vim_ex_help.vim
index 4d13f3202f9d1e52def1093919051966d1f9d876..c673fe6b0a40ce3fad9521f31449b2db807ac13b 100644
GIT binary patch
delta 149
zcmcb>c8h(2t(KBPn5S=ih-+|2e6VXsXn;aSrb13;UbaG6X0CH?N^oj{LU2K9a%N)A
zMjH|4_>9z?0)-kb2nDBWxRex9a|=o;74lLmN)(dwb8{2(QWP{wiV`z{hNUZ%XJnS7
V78fKYr)om=D!|NuGinsLxB%_kGPD2y

delta 10
Rcmcb`et~U*?ZymYW&jv11GE4D

diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 27d15872c..7f6c38e01 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougk...@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="\%(@ \)\=\ze\s*\%($\|\%x0d\|\%x00\||\s*\S\)"
+ \ end="\%(@ \)\=\ze\s*\%($\|\%x0d\|\%x00\||[^|]\)"
\ oneline
+syn match vimHelpNextCommand contained "\ze|[^|]" skipwhite nextgroup=vimCmdSep
syn match vimHelpBang contained " \@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
diff --git a/src/testdir/test_help.vim b/src/testdir/test_help.vim
index 33e5234b5..df2b0c0ab 100644
--- a/src/testdir/test_help.vim
+++ b/src/testdir/test_help.vim
@@ -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("
")[-1])
+ call assert_equal("nextcmd",
+ \ execute("help || echo 'nextcmd'")->split("
")[-1])
+ call assert_equal("nextcmd",
+ \ execute("help \<NL> echo 'nextcmd'")->split("
")[-1])
+ call assert_equal("nextcmd",
+ \ execute("help \<CR> echo 'nextcmd'")->split("
")[-1])
+
+ helpclose
+endfunc

" vim: shiftwidth=2 sts=2 expandtab
Reply all
Reply to author
Forward
0 new messages