Skip to content

Commit 74c7ffc

Browse files
committed
'main': Factor out common logic to after the case/esac.
1 parent 8feb06a commit 74c7ffc

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

highlighters/main/main-highlighter.zsh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,6 @@ _zsh_highlight_main_highlighter_highlight_list()
656656
local MATCH; integer MBEGIN MEND
657657
local parameter_name
658658
local -a words
659-
integer elision_is_happening
660659
if [[ $arg[1] == '$' ]] && [[ ${arg[2]} == '{' ]] && [[ ${arg[-1]} == '}' ]]; then
661660
parameter_name=${${arg:2}%?}
662661
elif [[ $arg[1] == '$' ]]; then
@@ -670,20 +669,18 @@ _zsh_highlight_main_highlighter_highlight_list()
670669
case ${(tP)MATCH} in
671670
(*array*|*assoc*)
672671
words=( ${(P)MATCH} )
673-
elision_is_happening=$(( $#words == 0 ))
674672
;;
675673
("")
676674
# not set
677675
words=( )
678-
elision_is_happening=1
679676
;;
680677
(*)
681678
# scalar, presumably
682679
words=( ${(P)MATCH} )
683-
elision_is_happening=$(( $#words == 0 ))
684680
;;
685681
esac
686-
if (( elision_is_happening )); then
682+
if (( $#words == 0 )); then
683+
# Parameter elision is happening
687684
(( ++in_redirection ))
688685
_zsh_highlight_main_add_region_highlight $start_pos $end_pos comment
689686
continue

0 commit comments

Comments
 (0)