From 1ec43c7291db3327391360e466907329b36c6770 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Fri, 29 Jun 2018 22:08:33 -0600 Subject: [PATCH] Fix error when single quote entered into buffer Error looked something like: ``` % echo 'f(zpty):8: unmatched ' _zsh_autosuggest_capture_completion:zpty:9: no such pty command: zsh_autosuggest_completion_pty _zsh_autosuggest_capture_completion:zpty:14: no such pty command: zsh_autosuggest_completion_pty _zsh_autosuggest_capture_completion:zpty:21: no such pty command: zsh_autosuggest_completion_pty ``` According to `man zshmodules`, the args to `zpty` are "concatenated with spaces between, then executed as a command, as if passed to the eval builtin." So we need to escape the `$` so that `$1` is passed to eval instead of the value of `$1`. --- src/strategies/completion.zsh | 2 +- zsh-autosuggestions.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index 30542ee..8bbd7c8 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -94,7 +94,7 @@ _zsh_autosuggest_capture_completion() { if zle; then zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME zle autosuggest-capture-completion else - zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME "_zsh_autosuggest_capture_buffer '$1'" + zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_buffer "\$1" zpty -w $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME $'\t' fi diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 17e0d52..6f27260 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -593,7 +593,7 @@ _zsh_autosuggest_capture_completion() { if zle; then zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME zle autosuggest-capture-completion else - zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME "_zsh_autosuggest_capture_buffer '$1'" + zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_buffer "\$1" zpty -w $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME $'\t' fi