Skip to content

Commit 3174e37

Browse files
committed
'main': Fix highlighting of null execs.
Fixes #676.
1 parent f56e3fa commit 3174e37

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
- Don't look up absolute directory names in $cdpath
2727
[2cc2583f8f12, part of #669]
2828

29+
- Fix "exec 2>&1;" being highlighted as an error.
30+
[#676]
31+
2932
# Changes in version 0.7.1
3033

3134
- Remove out-of-date information from the 0.7.0 changelog.

highlighters/main/main-highlighter.zsh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,10 @@ _zsh_highlight_main_highlighter_highlight_list()
824824
next_word=${next_word//:regular:/}
825825
next_word+=':sudo_opt:'
826826
next_word+=':start:'
827+
if [[ $arg == 'exec' ]]; then
828+
# To allow "exec 2>&1;" where there's no command word
829+
next_word+=':regular:'
830+
fi
827831
else
828832
case $res in
829833
reserved) # reserved word

highlighters/main/test-data/null-exec.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ expected_region_highlight=(
3434
'1 4 precommand' # exec
3535
'6 6 redirection' # >
3636
'7 15 path' # /dev/null
37-
'16 16 commandseparator "issue #676"' # ;
37+
'16 16 commandseparator' # ;
3838
)

0 commit comments

Comments
 (0)