mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2026-06-23 16:41:17 +02:00
Simplify escaping of pattern and fix match_prev_cmd strategy
Maybe this is also a fix for #247, #248 and #258. Supersedes #267. Testcase: Using match_prev_cmd strategy and with these lines in history: echo '1^' echo '2^' echo '1^' type: echo (unexpected suggestion echo '1^' instead of echo '2^') echo '1^1 (wrong suggestion echo '1^1echo '1^') echo '1^# (error "bad math expression")
This commit is contained in:
parent
33b91a9dea
commit
7f8ff2867c
5 changed files with 10 additions and 53 deletions
11
src/util.zsh
11
src/util.zsh
|
|
@ -1,11 +0,0 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Utility Functions #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
_zsh_autosuggest_escape_command() {
|
||||
setopt localoptions EXTENDED_GLOB
|
||||
|
||||
# Escape special chars in the string (requires EXTENDED_GLOB)
|
||||
echo -E "${1//(#m)[\"\'\\()\[\]|*?~]/\\$MATCH}"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue