Highlight the first part of multiline strings correctly

Given the following input:
    PREBUFFER=$'echo "foo\n'
    BUFFER='bar"'
This patch causes the '"foo' part to be highlighted as a string.  There
is no test because the tests only check highlighting of BUFFER, and 'bar"'
is already highlighted correctly.
This commit is contained in:
Daniel Shahaf 2015-01-28 13:28:09 +00:00
parent 384be15b13
commit ff4d402e9a

View File

@ -177,13 +177,13 @@ _zsh_highlight_main_highlighter()
case $arg in case $arg in
'--'*) style=$ZSH_HIGHLIGHT_STYLES[double-hyphen-option];; '--'*) style=$ZSH_HIGHLIGHT_STYLES[double-hyphen-option];;
'-'*) style=$ZSH_HIGHLIGHT_STYLES[single-hyphen-option];; '-'*) style=$ZSH_HIGHLIGHT_STYLES[single-hyphen-option];;
"'"*"'") style=$ZSH_HIGHLIGHT_STYLES[single-quoted-argument];; "'"*) style=$ZSH_HIGHLIGHT_STYLES[single-quoted-argument];;
'"'*'"') style=$ZSH_HIGHLIGHT_STYLES[double-quoted-argument] '"'*) style=$ZSH_HIGHLIGHT_STYLES[double-quoted-argument]
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $style _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style
_zsh_highlight_main_highlighter_highlight_string _zsh_highlight_main_highlighter_highlight_string
substr_color=1 substr_color=1
;; ;;
'`'*'`') style=$ZSH_HIGHLIGHT_STYLES[back-quoted-argument];; '`'*) style=$ZSH_HIGHLIGHT_STYLES[back-quoted-argument];;
*"*"*) $highlight_glob && style=$ZSH_HIGHLIGHT_STYLES[globbing] || style=$ZSH_HIGHLIGHT_STYLES[default];; *"*"*) $highlight_glob && style=$ZSH_HIGHLIGHT_STYLES[globbing] || style=$ZSH_HIGHLIGHT_STYLES[default];;
*) if _zsh_highlight_main_highlighter_check_path; then *) if _zsh_highlight_main_highlighter_check_path; then
style=$ZSH_HIGHLIGHT_STYLES[path] style=$ZSH_HIGHLIGHT_STYLES[path]