diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index 246f0bd..8dc1f9d 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -108,8 +108,10 @@ _zsh_autosuggest_strategy_completion() { # content between the first two null bytes. zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0' - # On older versions of zsh, we sometimes get extra bytes after the - # second null byte, so trim those off the end + # Extract the suggestion from between the null bytes. On older + # versions of zsh (older than 5.3), we sometimes get extra bytes after + # the second null byte, so trim those off the end. + # See http://www.zsh.org/mla/workers/2015/msg03290.html suggestion="${${${(M)line:#*$'\0'*$'\0'*}#*$'\0'}%%$'\0'*}" } always { # Destroy the pty diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 753228e..cef55f8 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -590,8 +590,10 @@ _zsh_autosuggest_strategy_completion() { # content between the first two null bytes. zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0' - # On older versions of zsh, we sometimes get extra bytes after the - # second null byte, so trim those off the end + # Extract the suggestion from between the null bytes. On older + # versions of zsh (older than 5.3), we sometimes get extra bytes after + # the second null byte, so trim those off the end. + # See http://www.zsh.org/mla/workers/2015/msg03290.html suggestion="${${${(M)line:#*$'\0'*$'\0'*}#*$'\0'}%%$'\0'*}" } always { # Destroy the pty