From: Doug Kearns Date: Sun, 11 Jan 2026 18:25:38 +0000 (+0000) Subject: runtime(syntax-tests): Add :help command termination tests X-Git-Tag: v9.1.2078~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4dc4d8f1eca8e3989c5f7770b062e3cf344a936;p=thirdparty%2Fvim.git 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 Signed-off-by: Christian Brabandt --- diff --git a/.gitattributes b/.gitattributes index 46ac5f9cc6..695eaaa6d6 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 754ddb0539..ecb0b5c024 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 " Doug Kearns -" 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 "\" 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 "\" 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 24f30e6877..c740147518 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 206d8a5af9..82350a74de 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 f4a0374a4f..392120ace3 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 4a9e7a90c4..1cce14f6e0 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 4d13f3202f..c673fe6b0a 100644 Binary files a/runtime/syntax/testdir/input/vim_ex_help.vim and b/runtime/syntax/testdir/input/vim_ex_help.vim differ diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 27d15872cb..7f6c38e011 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -2,7 +2,7 @@ " Language: Vim script " Maintainer: Hirohito Higashi " Doug Kearns -" 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 "\" 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 "\" skipwhite nextgroup=vimHelpgrepBang,vimHelpgrepPattern syn region vimHelpgrepPattern contained diff --git a/src/testdir/test_help.vim b/src/testdir/test_help.vim index 33e5234b52..df2b0c0abc 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 | + call execute('help | ') + call assert_match('*help.txt\*', getline('.')) + + " :help {arg} | + call execute('help || ') + call assert_match('*bar\*', getline('.')) + + " :help {arg} + call assert_fails('help |||', 'E149:') + " :help {arg} | + call execute('help ||| ') + call assert_match('*expr-barbar\*', getline('.')) + + " :help {invalid-arg} + call assert_fails('help ||||', 'E149:') + " :help {invalid-arg} | + " (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 \ echo 'nextcmd'")->split("\n")[-1]) + call assert_equal("nextcmd", + \ execute("help \ echo 'nextcmd'")->split("\n")[-1]) + + helpclose +endfunc " vim: shiftwidth=2 sts=2 expandtab