From 3174e375f4d74e66fe032f5aa21c030c9f0d5ba8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 16 Mar 2020 21:50:04 +0000 Subject: [PATCH] 'main': Fix highlighting of null execs. Fixes #676. --- changelog.md | 3 +++ highlighters/main/main-highlighter.zsh | 4 ++++ highlighters/main/test-data/null-exec.zsh | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 6526092..d1a01ab 100644 --- a/changelog.md +++ b/changelog.md @@ -26,6 +26,9 @@ - Don't look up absolute directory names in $cdpath [2cc2583f8f12, part of #669] +- Fix "exec 2>&1;" being highlighted as an error. + [#676] + # Changes in version 0.7.1 - Remove out-of-date information from the 0.7.0 changelog. diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index fcc0c96..1234ac7 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -824,6 +824,10 @@ _zsh_highlight_main_highlighter_highlight_list() next_word=${next_word//:regular:/} next_word+=':sudo_opt:' next_word+=':start:' + if [[ $arg == 'exec' ]]; then + # To allow "exec 2>&1;" where there's no command word + next_word+=':regular:' + fi else case $res in reserved) # reserved word diff --git a/highlighters/main/test-data/null-exec.zsh b/highlighters/main/test-data/null-exec.zsh index ab73717..be1e306 100644 --- a/highlighters/main/test-data/null-exec.zsh +++ b/highlighters/main/test-data/null-exec.zsh @@ -34,5 +34,5 @@ expected_region_highlight=( '1 4 precommand' # exec '6 6 redirection' # > '7 15 path' # /dev/null - '16 16 commandseparator "issue #676"' # ; + '16 16 commandseparator' # ; )