@@ -888,6 +888,8 @@ _zsh_highlight_main_highlighter_highlight_single_quote()
888
888
if [[ $arg [i] == " '" ]]; then
889
889
style=single-quoted-argument
890
890
else
891
+ # If unclosed, i points past the end
892
+ (( i-- ))
891
893
style=single-quoted-argument-unclosed
892
894
fi
893
895
reply=($(( start_pos + arg1 - 1 )) $(( start_pos + i )) $style $reply )
@@ -902,7 +904,7 @@ _zsh_highlight_main_highlighter_highlight_double_quote()
902
904
local i j k style
903
905
reply=()
904
906
905
- for (( i = $1 + 1 ; i < end_pos - start_pos ; i += 1 )) ; do
907
+ for (( i = $1 + 1 ; i <= end_pos - start_pos ; i += 1 )) ; do
906
908
(( j = i + start_pos - 1 ))
907
909
(( k = j + 1 ))
908
910
case " $arg [$i ]" in
@@ -959,6 +961,8 @@ _zsh_highlight_main_highlighter_highlight_double_quote()
959
961
if [[ $arg [i] == ' "' ]]; then
960
962
style=double-quoted-argument
961
963
else
964
+ # If unclosed, i points past the end
965
+ (( i-- ))
962
966
style=double-quoted-argument-unclosed
963
967
fi
964
968
reply=($(( start_pos + $1 - 1 )) $(( start_pos + i )) $style $reply )
@@ -975,7 +979,7 @@ _zsh_highlight_main_highlighter_highlight_dollar_quote()
975
979
integer c
976
980
reply=()
977
981
978
- for (( i = $1 + 2 ; i < end_pos - start_pos ; i += 1 )) ; do
982
+ for (( i = $1 + 2 ; i <= end_pos - start_pos ; i += 1 )) ; do
979
983
(( j = i + start_pos - 1 ))
980
984
(( k = j + 1 ))
981
985
case " $arg [$i ]" in
@@ -1011,6 +1015,8 @@ _zsh_highlight_main_highlighter_highlight_dollar_quote()
1011
1015
if [[ $arg [i] == " '" ]]; then
1012
1016
style=dollar-quoted-argument
1013
1017
else
1018
+ # If unclosed, i points past the end
1019
+ (( i-- ))
1014
1020
style=dollar-quoted-argument-unclosed
1015
1021
fi
1016
1022
reply=($(( start_pos + $1 - 1 )) $(( start_pos + i )) $style $reply )
@@ -1027,6 +1033,8 @@ _zsh_highlight_main_highlighter_highlight_backtick()
1027
1033
if [[ $arg [i] == ' `' ]]; then
1028
1034
style=back-quoted-argument
1029
1035
else
1036
+ # If unclosed, i points past the end
1037
+ (( i-- ))
1030
1038
style=back-quoted-argument-unclosed
1031
1039
fi
1032
1040
reply=($(( start_pos + arg1 - 1 )) $(( start_pos + i )) $style )
0 commit comments