From 50e6832b8c5f5b3aff9da8f7aaf5a0b836f27368 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Tue, 24 Jan 2017 23:05:50 -0700 Subject: [PATCH] Escape the prefix passed into the match_prev_cmd strategy --- src/strategies/match_prev_cmd.zsh | 2 +- zsh-autosuggestions.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/strategies/match_prev_cmd.zsh b/src/strategies/match_prev_cmd.zsh index bf8bdd9..632a24b 100644 --- a/src/strategies/match_prev_cmd.zsh +++ b/src/strategies/match_prev_cmd.zsh @@ -21,7 +21,7 @@ # `HIST_EXPIRE_DUPS_FIRST`. _zsh_autosuggest_strategy_match_prev_cmd() { - local prefix="$1" + local prefix="${1//(#m)[\\()\[\]|*?~]/\\$MATCH}" # Get all history event numbers that correspond to history # entries that match pattern $prefix* diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index a438c65..b72f3e2 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -453,7 +453,7 @@ _zsh_autosuggest_strategy_default() { # `HIST_EXPIRE_DUPS_FIRST`. _zsh_autosuggest_strategy_match_prev_cmd() { - local prefix="$1" + local prefix="${1//(#m)[\\()\[\]|*?~]/\\$MATCH}" # Get all history event numbers that correspond to history # entries that match pattern $prefix*