Skip to content

Commit 19cb0eb

Browse files
committed
Quote variable to highlight right words on zsh 4.3
When the variable is not quoted, there seems to be some difference in evaluating the line between zsh 4.3 and 5.6
1 parent 36505c4 commit 19cb0eb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

zsh-history-substring-search.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ _history-substring-search-end() {
324324
for query_part in $_history_substring_search_query_parts; do
325325
local escaped_query_part=${query_part//(#m)[\][()|\\*?#<>~^]/\\$MATCH}
326326
# (i) get index of pattern
327-
local query_part_match_index=${${BUFFER:$highlight_start_index}[(i)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${escaped_query_part}]}
327+
local query_part_match_index="${${BUFFER:$highlight_start_index}[(i)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${escaped_query_part}]}"
328328
if [[ $query_part_match_index -le ${#BUFFER:$highlight_start_index} ]]; then
329329
highlight_start_index=$(( $highlight_start_index + $query_part_match_index ))
330330
highlight_end_index=$(( $highlight_start_index + ${#query_part} ))

0 commit comments

Comments
 (0)