subshells: Highlight the opening parenthesis correctly. (Issue #166.)

Followup to 0d1bfbcbfa.
This commit is contained in:
Daniel Shahaf 2015-10-30 11:38:32 +02:00
parent 5a38710564
commit 9e178f9f39
2 changed files with 3 additions and 2 deletions

View File

@ -279,8 +279,9 @@ _zsh_highlight_main_highlighter()
style=$ZSH_HIGHLIGHT_STYLES[reserved-word] style=$ZSH_HIGHLIGHT_STYLES[reserved-word]
_zsh_highlight_main_add_region_highlight $start_pos $((start_pos + 2)) $style _zsh_highlight_main_add_region_highlight $start_pos $((start_pos + 2)) $style
already_added=1 already_added=1
elif [[ $arg == '()' ]]; then elif [[ $arg == '()' || $arg == $'\x28' ]]; then
# anonymous function # anonymous function
# subshell
style=$ZSH_HIGHLIGHT_STYLES[reserved-word] style=$ZSH_HIGHLIGHT_STYLES[reserved-word]
else else
if _zsh_highlight_main_highlighter_check_path; then if _zsh_highlight_main_highlighter_check_path; then

View File

@ -31,7 +31,7 @@ BUFFER='tar cf - * | (cd /target; tar xfp -)'
expected_region_highlight=( expected_region_highlight=(
"1 3 $ZSH_HIGHLIGHT_STYLES[command]" # tar "1 3 $ZSH_HIGHLIGHT_STYLES[command]" # tar
"14 14 $ZSH_HIGHLIGHT_STYLES[reserved-word] 'issue #166'" # ( "14 14 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # (
"15 16 $ZSH_HIGHLIGHT_STYLES[command]" # cd "15 16 $ZSH_HIGHLIGHT_STYLES[command]" # cd
"27 29 $ZSH_HIGHLIGHT_STYLES[command]" # tar "27 29 $ZSH_HIGHLIGHT_STYLES[command]" # tar
#"36 36 $ZSH_HIGHLIGHT_STYLES[?]" # ) #"36 36 $ZSH_HIGHLIGHT_STYLES[?]" # )