mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-12-27 22:43:41 +08:00
Simplify logic to extract suggestion from between null bytes
Just remove up to and including the first null byte and after and including the last null byte. I also looked into using `${${(0)line}[2]}`, but it fails when `$line` starts with a null byte, since the first split string will be empty and thus not included in the resulting array.
This commit is contained in:
parent
c04e015d13
commit
d94475ca1b
|
@ -112,7 +112,7 @@ _zsh_autosuggest_strategy_completion() {
|
|||
# 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="${${line#*$'\0'}%$'\0'*}"
|
||||
} always {
|
||||
# Destroy the pty
|
||||
zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME
|
||||
|
|
|
@ -594,7 +594,7 @@ _zsh_autosuggest_strategy_completion() {
|
|||
# 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="${${line#*$'\0'}%$'\0'*}"
|
||||
} always {
|
||||
# Destroy the pty
|
||||
zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME
|
||||
|
|
Loading…
Reference in New Issue
Block a user