mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-12-27 22:43:41 +08:00
Allow suggestions to suggest trailing newlines
Command substitution via $() trims trailing newlines so the old approach to reading everything from the fd was preventing suggestions from ending with newlines. Found the read solution here: https://stackoverflow.com/a/15184414/154703
This commit is contained in:
parent
e263845bed
commit
68343c8de4
|
@ -56,9 +56,12 @@ _zsh_autosuggest_async_request() {
|
|||
_zsh_autosuggest_async_response() {
|
||||
emulate -L zsh
|
||||
|
||||
local suggestion
|
||||
|
||||
if [[ -z "$2" || "$2" == "hup" ]]; then
|
||||
# Read everything from the fd and give it as a suggestion
|
||||
zle autosuggest-suggest -- "$(cat <&$1)"
|
||||
IFS='' read -rd '' -u $1 suggestion
|
||||
zle autosuggest-suggest -- "$suggestion"
|
||||
|
||||
# Close the fd
|
||||
exec {1}<&-
|
||||
|
|
|
@ -769,9 +769,12 @@ _zsh_autosuggest_async_request() {
|
|||
_zsh_autosuggest_async_response() {
|
||||
emulate -L zsh
|
||||
|
||||
local suggestion
|
||||
|
||||
if [[ -z "$2" || "$2" == "hup" ]]; then
|
||||
# Read everything from the fd and give it as a suggestion
|
||||
zle autosuggest-suggest -- "$(cat <&$1)"
|
||||
IFS='' read -rd '' -u $1 suggestion
|
||||
zle autosuggest-suggest -- "$suggestion"
|
||||
|
||||
# Close the fd
|
||||
exec {1}<&-
|
||||
|
|
Loading…
Reference in New Issue
Block a user