mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-18 09:51:06 +01:00
Use zpty -r
with pattern matching to fetch suggestion
This commit is contained in:
parent
5c891afd48
commit
b530b0c996
2 changed files with 8 additions and 8 deletions
|
@ -25,10 +25,10 @@ _zsh_autosuggest_async_suggestion_server() {
|
||||||
# First arg will be fd ready for reading
|
# First arg will be fd ready for reading
|
||||||
# Second arg will be passed in case of error
|
# Second arg will be passed in case of error
|
||||||
_zsh_autosuggest_async_suggestion_ready() {
|
_zsh_autosuggest_async_suggestion_ready() {
|
||||||
# while zpty -rt $ZSH_AUTOSUGGEST_PTY_NAME suggestion 2>/dev/null; do
|
local suggestion
|
||||||
while read -u $_ZSH_AUTOSUGGEST_PTY_FD -d $'\0' suggestion; do
|
|
||||||
zle _autosuggest-show-suggestion "${suggestion//$'\r'$'\n'/$'\n'}"
|
zpty -rt $ZSH_AUTOSUGGEST_PTY_NAME suggestion '*'$'\0' 2>/dev/null
|
||||||
done
|
zle _autosuggest-show-suggestion "${suggestion%$'\0'}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Recreate the pty to get a fresh list of history events
|
# Recreate the pty to get a fresh list of history events
|
||||||
|
|
|
@ -502,10 +502,10 @@ _zsh_autosuggest_async_suggestion_server() {
|
||||||
# First arg will be fd ready for reading
|
# First arg will be fd ready for reading
|
||||||
# Second arg will be passed in case of error
|
# Second arg will be passed in case of error
|
||||||
_zsh_autosuggest_async_suggestion_ready() {
|
_zsh_autosuggest_async_suggestion_ready() {
|
||||||
# while zpty -rt $ZSH_AUTOSUGGEST_PTY_NAME suggestion 2>/dev/null; do
|
local suggestion
|
||||||
while read -u $_ZSH_AUTOSUGGEST_PTY_FD -d $'\0' suggestion; do
|
|
||||||
zle _autosuggest-show-suggestion "${suggestion//$'\r'$'\n'/$'\n'}"
|
zpty -rt $ZSH_AUTOSUGGEST_PTY_NAME suggestion '*'$'\0' 2>/dev/null
|
||||||
done
|
zle _autosuggest-show-suggestion "${suggestion%$'\0'}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Recreate the pty to get a fresh list of history events
|
# Recreate the pty to get a fresh list of history events
|
||||||
|
|
Loading…
Reference in a new issue