@@ -85,6 +85,10 @@ _zsh_highlight_main_add_region_highlight() {
85
85
# in _zsh_highlight_main_highlighter_highlight_path_separators().
86
86
path_pathseparator path
87
87
path_prefix_pathseparator path_prefix
88
+
89
+ single-quoted-argument{-unclosed,}
90
+ double-quoted-argument{-unclosed,}
91
+ dollar-single-quoted-argument{-unclosed,}
88
92
)
89
93
local needle=$1 value
90
94
while [[ -n ${value::= $fallback_of [$needle]} ]]; do
@@ -840,7 +844,7 @@ _zsh_highlight_main_highlighter_highlight_argument()
840
844
# Highlight single-quoted strings
841
845
_zsh_highlight_main_highlighter_highlight_single_quote ()
842
846
{
843
- local arg1=$1 i q=\'
847
+ local arg1=$1 i q=\' style
844
848
local -a highlights
845
849
i=$arg [(ib:arg1+1:)$q ]
846
850
@@ -852,7 +856,12 @@ _zsh_highlight_main_highlighter_highlight_single_quote()
852
856
done
853
857
fi
854
858
855
- highlights=($(( start_pos + $1 - 1 )) $(( start_pos + i )) single-quoted-argument $highlights )
859
+ if [[ $arg [i] == " '" ]]; then
860
+ style=single-quoted-argument
861
+ else
862
+ style=single-quoted-argument-unclosed
863
+ fi
864
+ highlights+=($(( start_pos + $1 - 1 )) $(( start_pos + i )) $style $highlights )
856
865
_zsh_highlight_main_add_many_region_highlights $highlights
857
866
REPLY=$i
858
867
}
@@ -912,7 +921,12 @@ _zsh_highlight_main_highlighter_highlight_double_quote()
912
921
highlights+=($j $k $style )
913
922
done
914
923
915
- highlights=($(( start_pos + $1 - 1 )) $(( start_pos + i )) double-quoted-argument $highlights )
924
+ if [[ $arg [i] == ' "' ]]; then
925
+ style=double-quoted-argument
926
+ else
927
+ style=double-quoted-argument-unclosed
928
+ fi
929
+ highlights=($(( start_pos + $1 - 1 )) $(( start_pos + i )) $style $highlights )
916
930
_zsh_highlight_main_add_many_region_highlights $highlights
917
931
REPLY=$i
918
932
}
@@ -959,7 +973,12 @@ _zsh_highlight_main_highlighter_highlight_dollar_quote()
959
973
highlights+=($j $k $style )
960
974
done
961
975
962
- highlights=($(( start_pos + $1 - 1 )) $(( start_pos + i )) dollar-quoted-argument $highlights )
976
+ if [[ $arg [i] == " '" ]]; then
977
+ style=dollar-quoted-argument
978
+ else
979
+ style=dollar-quoted-argument-unclosed
980
+ fi
981
+ highlights+=($(( start_pos + $1 - 1 )) $(( start_pos + i )) $style $highlights )
963
982
_zsh_highlight_main_add_many_region_highlights $highlights
964
983
REPLY=$i
965
984
}
0 commit comments