fix highlighting of query in matching commands

Without this commit, searching for "rebo" in "reboot" incorrectly causes
"eboo" to be highlighted instead of "rebo".
This commit is contained in:
Guido van Steen 2011-06-15 03:41:01 -07:00 committed by Suraj N. Kurapati
parent 53b70a0b82
commit 1022df5a5a

View file

@ -205,9 +205,9 @@ history-substring-search-highlight() {
# which indicates the end position of the first occurrence of
# $history_substring_search_query_escaped in $BUFFER
: ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($history_substring_search_query##)}
let "history_substring_search_query_mbegin = $MEND - $#history_substring_search_query"
# this is slightly more informative than highlighting that fish performs
region_highlight+=("$history_substring_search_query_mbegin $MEND $1")
let "history_substring_search_query_mbegin = $MBEGIN - 1"
let "history_substring_search_query_mend = $history_substring_search_query_mbegin + $#history_substring_search_query"
region_highlight+=("$history_substring_search_query_mbegin $history_substring_search_query_mend $1")
fi
}