From 43a011026ffd9c7e9dba4cf022922a4877f1d4e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20V=C3=A4th?= Date: Mon, 18 Jun 2018 19:47:27 +0200 Subject: [PATCH] Do not leak global variables REPLY and strategy https://github.com/zsh-users/zsh-autosuggestions/issues/341 --- src/fetch.zsh | 1 + src/strategies/completion.zsh | 2 +- zsh-autosuggestions.zsh | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fetch.zsh b/src/fetch.zsh index f94e66d..1517018 100644 --- a/src/fetch.zsh +++ b/src/fetch.zsh @@ -9,6 +9,7 @@ _zsh_autosuggest_fetch_suggestion() { typeset -g suggestion local -a strategies + local strategy # Ensure we are working with an array strategies=(${=ZSH_AUTOSUGGEST_STRATEGY}) diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index 847f22b..30542ee 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -88,7 +88,7 @@ _zsh_autosuggest_capture_buffer() { _zsh_autosuggest_capture_completion() { typeset -g completion - local line + local line REPLY # Zle will be inactive if we are in async mode if zle; then diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 8aad4c8..17e0d52 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -587,7 +587,7 @@ _zsh_autosuggest_capture_buffer() { _zsh_autosuggest_capture_completion() { typeset -g completion - local line + local line REPLY # Zle will be inactive if we are in async mode if zle; then @@ -716,6 +716,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() { _zsh_autosuggest_fetch_suggestion() { typeset -g suggestion local -a strategies + local strategy # Ensure we are working with an array strategies=(${=ZSH_AUTOSUGGEST_STRATEGY})