From fc9c892a3f1548c7c49c73e4a7d110dbb13fdfd4 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 9 May 2016 03:26:06 +0000 Subject: [PATCH] 'main': Fix issue #302, "Process substitution misparsed as redirection". --- highlighters/main/main-highlighter.zsh | 6 +++++- highlighters/main/test-data/redirection2.zsh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index bfcd882..e0de002 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -96,7 +96,11 @@ _zsh_highlight_main__type() { # Check whether the first argument is a redirection operator token. # Report result via the exit code. _zsh_highlight_main__is_redirection() { - [[ $1 == (<0-9>|)(\<|\>)* ]] + # A redirection operator token: + # - starts with an optional single-digit number; + # - then, has a '<' or '>' character; + # - is not a process substitution [<(...) or >(...)]. + [[ $1 == (<0-9>|)(\<|\>)* ]] && [[ $1 != (\<|\>)$'\x28'* ]] } # Main syntax highlighting function. diff --git a/highlighters/main/test-data/redirection2.zsh b/highlighters/main/test-data/redirection2.zsh index bf5cb5a..83f7c08 100644 --- a/highlighters/main/test-data/redirection2.zsh +++ b/highlighters/main/test-data/redirection2.zsh @@ -32,5 +32,5 @@ BUFFER='ls >(wc) | nl' expected_region_highlight=( "1 2 command" # ls "10 10 commandseparator" # | - "12 13 command 'issue #302'" # nl + "12 13 command" # nl )