diff --git a/script/test.zsh b/script/test.zsh index ba563a6..945e649 100755 --- a/script/test.zsh +++ b/script/test.zsh @@ -334,37 +334,37 @@ testEscapeCommandPrefix() { assertEquals \ "Did not escape single backslash" \ "\\\\" \ - "$(_zsh_autosuggest_escape_command_prefix "\\")" + "$(_zsh_autosuggest_escape_command "\\")" assertEquals \ "Did not escape two backslashes" \ "\\\\\\\\" \ - "$(_zsh_autosuggest_escape_command_prefix "\\\\")" + "$(_zsh_autosuggest_escape_command "\\\\")" assertEquals \ "Did not escape parentheses" \ "\\(\\)" \ - "$(_zsh_autosuggest_escape_command_prefix "()")" + "$(_zsh_autosuggest_escape_command "()")" assertEquals \ "Did not escape square brackets" \ "\\[\\]" \ - "$(_zsh_autosuggest_escape_command_prefix "[]")" + "$(_zsh_autosuggest_escape_command "[]")" assertEquals \ "Did not escape pipe" \ "\\|" \ - "$(_zsh_autosuggest_escape_command_prefix "|")" + "$(_zsh_autosuggest_escape_command "|")" assertEquals \ "Did not escape star" \ "\\*" \ - "$(_zsh_autosuggest_escape_command_prefix "*")" + "$(_zsh_autosuggest_escape_command "*")" assertEquals \ "Did not escape question mark" \ "\\?" \ - "$(_zsh_autosuggest_escape_command_prefix "?")" + "$(_zsh_autosuggest_escape_command "?")" } # For zsh compatibility diff --git a/src/strategies/default.zsh b/src/strategies/default.zsh index 86b12f8..b409621 100644 --- a/src/strategies/default.zsh +++ b/src/strategies/default.zsh @@ -7,7 +7,7 @@ # _zsh_autosuggest_strategy_default() { - local prefix="$(_zsh_autosuggest_escape_command_prefix "$1")" + local prefix="$(_zsh_autosuggest_escape_command "$1")" # Get the hist number of the most recent history item that matches local histkey="${${(@k)history[(R)$prefix*]}[1]}" diff --git a/src/strategies/match_prev_cmd.zsh b/src/strategies/match_prev_cmd.zsh index bbcea9c..a0005b2 100644 --- a/src/strategies/match_prev_cmd.zsh +++ b/src/strategies/match_prev_cmd.zsh @@ -17,7 +17,7 @@ # _zsh_autosuggest_strategy_match_prev_cmd() { - local prefix="$(_zsh_autosuggest_escape_command_prefix "$1")" + local prefix="$(_zsh_autosuggest_escape_command "$1")" # Get all history event numbers that correspond to history # entries that match pattern $prefix* @@ -29,7 +29,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() { # Get the previously executed command local prev_cmd="$(_zsh_autosuggest_prev_command)" - prev_cmd="$(_zsh_autosuggest_escape_command_prefix $prev_cmd)" + prev_cmd="$(_zsh_autosuggest_escape_command $prev_cmd)" # Iterate up to the first 200 history event numbers that match $prefix for key in "${(@)history_match_keys[1,200]}"; do diff --git a/src/suggestion.zsh b/src/suggestion.zsh index ece0a89..f5aea2c 100644 --- a/src/suggestion.zsh +++ b/src/suggestion.zsh @@ -13,7 +13,7 @@ _zsh_autosuggest_suggestion() { fi } -_zsh_autosuggest_escape_command_prefix() { +_zsh_autosuggest_escape_command() { setopt localoptions EXTENDED_GLOB # Escape special chars in the string (requires EXTENDED_GLOB) diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index f6f1f9f..a37e6b4 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -323,7 +323,7 @@ _zsh_autosuggest_suggestion() { fi } -_zsh_autosuggest_escape_command_prefix() { +_zsh_autosuggest_escape_command() { setopt localoptions EXTENDED_GLOB # Escape special chars in the string (requires EXTENDED_GLOB) @@ -343,7 +343,7 @@ _zsh_autosuggest_prev_command() { # _zsh_autosuggest_strategy_default() { - local prefix="$(_zsh_autosuggest_escape_command_prefix "$1")" + local prefix="$(_zsh_autosuggest_escape_command "$1")" # Get the hist number of the most recent history item that matches local histkey="${${(@k)history[(R)$prefix*]}[1]}" @@ -370,7 +370,7 @@ _zsh_autosuggest_strategy_default() { # _zsh_autosuggest_strategy_match_prev_cmd() { - local prefix="$(_zsh_autosuggest_escape_command_prefix "$1")" + local prefix="$(_zsh_autosuggest_escape_command "$1")" # Get all history event numbers that correspond to history # entries that match pattern $prefix* @@ -382,7 +382,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() { # Get the previously executed command local prev_cmd="$(_zsh_autosuggest_prev_command)" - prev_cmd="$(_zsh_autosuggest_escape_command_prefix $prev_cmd)" + prev_cmd="$(_zsh_autosuggest_escape_command $prev_cmd)" # Iterate up to the first 200 history event numbers that match $prefix for key in "${(@)history_match_keys[1,200]}"; do