mirror of
https://github.com/zsh-users/zsh-history-substring-search
synced 2024-09-20 16:19:04 +02:00
Fix logic used to build fuzzy search regex
The intent was to insert '*' between all characters in the query, except for those which were escaped with '\'. What the old implementation did, however, was strip out all backslashes and place '*' between all remaining characters, as when a backslash was detected the loop would skip to the next character without appending the backslash to the regex. The new logic is something like "add the character, then add '*' if the character was not a backslash", which should be correct
This commit is contained in:
parent
9d291f18f7
commit
9551fe6cc7
|
@ -220,8 +220,8 @@ _history-substring-search-begin() {
|
|||
|
||||
fuzzy_regex="*"
|
||||
for char ({1..$#escaped_query}); do
|
||||
[[ escaped_query[$char] == '\' ]] && continue
|
||||
fuzzy_regex+="${escaped_query[$char]}*"
|
||||
fuzzy_regex+="${escaped_query[$char]}"
|
||||
[[ escaped_query[$char] != '\' ]] && fuzzy_regex+="*"
|
||||
done
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue