Disable word splitting while reading to preserve whitespace

This commit is contained in:
Eric Freese 2017-01-24 21:58:17 -07:00
parent b530b0c996
commit 0337005eb0
2 changed files with 4 additions and 4 deletions

View file

@ -5,14 +5,14 @@
_zsh_autosuggest_async_fetch_suggestion() { _zsh_autosuggest_async_fetch_suggestion() {
# Send the prefix to the pty to fetch a suggestion # Send the prefix to the pty to fetch a suggestion
zpty -w -n $ZSH_AUTOSUGGEST_PTY_NAME $1 $'\0' zpty -w -n $ZSH_AUTOSUGGEST_PTY_NAME "${1}"$'\0'
} }
# Pty is spawned running this function # Pty is spawned running this function
_zsh_autosuggest_async_suggestion_server() { _zsh_autosuggest_async_suggestion_server() {
emulate -R zsh emulate -R zsh
while read -d $'\0' prefix; do while IFS='' read -r -d $'\0' prefix; do
# Kill last bg process # Kill last bg process
kill -KILL %1 &>/dev/null kill -KILL %1 &>/dev/null

View file

@ -482,14 +482,14 @@ _zsh_autosuggest_strategy_match_prev_cmd() {
_zsh_autosuggest_async_fetch_suggestion() { _zsh_autosuggest_async_fetch_suggestion() {
# Send the prefix to the pty to fetch a suggestion # Send the prefix to the pty to fetch a suggestion
zpty -w -n $ZSH_AUTOSUGGEST_PTY_NAME $1 $'\0' zpty -w -n $ZSH_AUTOSUGGEST_PTY_NAME "${1}"$'\0'
} }
# Pty is spawned running this function # Pty is spawned running this function
_zsh_autosuggest_async_suggestion_server() { _zsh_autosuggest_async_suggestion_server() {
emulate -R zsh emulate -R zsh
while read -d $'\0' prefix; do while IFS='' read -r -d $'\0' prefix; do
# Kill last bg process # Kill last bg process
kill -KILL %1 &>/dev/null kill -KILL %1 &>/dev/null