From 0337005eb05de7f9f99b1fbb42b8da72eddbf5ff Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Tue, 24 Jan 2017 21:58:17 -0700 Subject: [PATCH] Disable word splitting while reading to preserve whitespace --- src/async.zsh | 4 ++-- zsh-autosuggestions.zsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/async.zsh b/src/async.zsh index 1535297..0e29a3f 100644 --- a/src/async.zsh +++ b/src/async.zsh @@ -5,14 +5,14 @@ _zsh_autosuggest_async_fetch_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 _zsh_autosuggest_async_suggestion_server() { emulate -R zsh - while read -d $'\0' prefix; do + while IFS='' read -r -d $'\0' prefix; do # Kill last bg process kill -KILL %1 &>/dev/null diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 34c1f90..ff3f0ac 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -482,14 +482,14 @@ _zsh_autosuggest_strategy_match_prev_cmd() { _zsh_autosuggest_async_fetch_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 _zsh_autosuggest_async_suggestion_server() { emulate -R zsh - while read -d $'\0' prefix; do + while IFS='' read -r -d $'\0' prefix; do # Kill last bg process kill -KILL %1 &>/dev/null