Add to explanation of extra stuff after zpty -r

This commit is contained in:
Eric Freese 2019-04-17 23:29:52 -06:00
parent e9ce05c4c1
commit c04e015d13
2 changed files with 8 additions and 4 deletions

View file

@ -108,8 +108,10 @@ _zsh_autosuggest_strategy_completion() {
# content between the first two null bytes. # content between the first two null bytes.
zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0' zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0'
# On older versions of zsh, we sometimes get extra bytes after the # Extract the suggestion from between the null bytes. On older
# second null byte, so trim those off the end # 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'*}" suggestion="${${${(M)line:#*$'\0'*$'\0'*}#*$'\0'}%%$'\0'*}"
} always { } always {
# Destroy the pty # Destroy the pty

View file

@ -590,8 +590,10 @@ _zsh_autosuggest_strategy_completion() {
# content between the first two null bytes. # content between the first two null bytes.
zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0' zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0'
# On older versions of zsh, we sometimes get extra bytes after the # Extract the suggestion from between the null bytes. On older
# second null byte, so trim those off the end # 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'*}" suggestion="${${${(M)line:#*$'\0'*$'\0'*}#*$'\0'}%%$'\0'*}"
} always { } always {
# Destroy the pty # Destroy the pty