about summary refs log tree commit diff
path: root/Util
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-19 20:27:37 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-20 01:44:06 +0000
commit65f8e90f0d0eccf12f73d717439016d8db872622 (patch)
tree1d96c9e772bed7b6e9c1085ee5b7902ddc704113 /Util
parentb13e8d16cf3239bd8b4b0434055d25fe4b3d7e7c (diff)
downloadzsh-65f8e90f0d0eccf12f73d717439016d8db872622.tar.gz
zsh-65f8e90f0d0eccf12f73d717439016d8db872622.tar.xz
zsh-65f8e90f0d0eccf12f73d717439016d8db872622.zip
unposted: internal: ztst.vim: Make sure syntax elements are only hidden if they're followed by something visible
Diffstat (limited to 'Util')
-rw-r--r--Util/ztst-syntax.vim23
1 files changed, 16 insertions, 7 deletions
diff --git a/Util/ztst-syntax.vim b/Util/ztst-syntax.vim
index a39fe3fbb..b4cabef2c 100644
--- a/Util/ztst-syntax.vim
+++ b/Util/ztst-syntax.vim
@@ -35,25 +35,25 @@ syn match  ztstPayload             /^\s.*/ contains=@zsh
 
 syn match  ztstExitCode            /^\d\+\|^-/                nextgroup=ztstFlags
 syn match  ztstFlags               /[.dDqf]*:/      contained nextgroup=ztstTestName contains=ztstColon
-syn match  ztstColon               /:/              contained
+syn match  ztstColon               /:.\@=/          contained
 syn region ztstTestName            start=// end=/$/ contained 
 
-syn match  ztstInputMarker         /^</                       nextgroup=ztstInput
+syn match  ztstInputMarker         /^<.\@=/                   nextgroup=ztstInput
 syn region ztstInput               start=// end=/$/ contained
 
 syn match  ztstOutputPattern       /^[*]>/                    nextgroup=ztstOutput   contains=ztstOutputPatternSigil,ztstOutputPatternMarker
 syn match  ztstOutputPatternSigil  /[*]/            contained
-syn match  ztstOutputPatternMarker /[>]/            contained conceal
-syn match  ztstOutputLiteral       /^>/                       nextgroup=ztstOutput
+syn match  ztstOutputPatternMarker /[>].\@=/        contained conceal
+syn match  ztstOutputLiteral       /^>.\@=/                   nextgroup=ztstOutput
 syn region ztstOutput              start=// end=/$/ contained
 
 syn match  ztstErrputPattern       /^[*][?]/                  nextgroup=ztstErrput   contains=ztstErrputPatternSigil,ztstErrputPatternMarker
 syn match  ztstErrputPatternSigil  /[*]/            contained
-syn match  ztstErrputPatternMarker /[?]/            contained conceal
-syn match  ztstErrputLiteral       /^[?]/                     nextgroup=ztstErrput
+syn match  ztstErrputPatternMarker /[?].\@=/        contained conceal
+syn match  ztstErrputLiteral       /^[?].\@=/                 nextgroup=ztstErrput
 syn region ztstErrput              start=// end=/$/ contained
 
-syn match  ztstFrequentExplanationMarker /^F:/                nextgroup=ztstFrequentExplanation
+syn match  ztstFrequentExplanationMarker /^F:.\@=/            nextgroup=ztstFrequentExplanation
 syn region ztstFrequentExplanation start=// end=/$/ contained
 
 syn match  ztstDirective           /^%.*/
@@ -75,6 +75,15 @@ syn keyword ztstSpecialVariable ZTST_unimplemented ZTST_skip ZTST_testdir ZTST_f
 syn sync maxlines=1
 
 "" Highlight groups:
+" Note: every group that's defaulted to "Ignore" has a match pattern that ends
+" with /.\@=/.  This ensures the Ignore will only be effective if there is an
+" immediately following group that _will_ be highlighted.  (That group will be
+" one of ztstTestName, ztstInput, ztstOutput, and ztstErrput.)
+"
+" ### The Ignore would still apply if the rest of the line is all-whitespace.
+" ###
+" ### If you run into such lines, consider setting the 'list' and 'listchars'
+" ### options appropriately.
 hi def link ztstExitCode                  Number
 hi def link ztstFlags                     Normal
 hi def link ztstColon                     Ignore