Skip to content

Commit

Permalink
'main': simple parameter expansions at command word: Don't use an und…
Browse files Browse the repository at this point in the history
…efined value.

Causes such expansions to be highlighted as [unknown-token] rather than as default (absent from $region_highlight).

Fixes sorin-ionescu#337.
  • Loading branch information
danielshahaf committed Jun 10, 2016
1 parent da91264 commit d9e07b5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion highlighters/main/main-highlighter.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ _zsh_highlight_main_highlighter()
local -a match mbegin mend
local MATCH; integer MBEGIN MEND
if [[ $res == none ]] && (( ${+parameters} )) &&
[[ ${arg[1]} == \$ ]] && [[ ${arg:1} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+)$ ]]; then
[[ ${arg[1]} == \$ ]] && [[ ${arg:1} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+)$ ]] &&
(( ${+parameters[${MATCH}]} ))
then
_zsh_highlight_main__type ${(P)MATCH}
res=$REPLY
fi
Expand Down

0 comments on commit d9e07b5

Please sign in to comment.