mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2026-10-02 16:03:50 +02: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:
1 parent
e263845bed
commit
68343c8de4
2 files changed
+8
-2
No files matched your search
+4
-1
@@ -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}<&-
|
||||
|
||||
Reference in new issue
Block a user