Skip to content

Commit

Permalink
[zsh] Fix backslash escaping
Browse files Browse the repository at this point in the history
Fix #3859

To test:

  FZF_CTRL_T_COMMAND="echo -E 'foo\bar\baz'; echo -E 'hello\world'"

  _fzf_compgen_path() {
    eval $FZF_CTRL_T_COMMAND
  }

  source shell/key-bindings.zsh
  source shell/completion.zsh
  • Loading branch information
junegunn committed Jul 4, 2024
1 parent 035b0be commit 69e1eed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions shell/completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ __fzf_generic_path_completion() {
rest=${FZF_COMPLETION_PATH_OPTS-}
fi
__fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" --walker "$walker" --walker-root="$dir" ${(Q)${(Z+n+)rest}} < /dev/tty
fi | while read item; do
fi | while read -r item; do
item="${item%$suffix}$suffix"
echo -n "${(q)item} "
echo -n -E "${(q)item} "
done
)
matches=${matches% }
Expand Down
4 changes: 2 additions & 2 deletions shell/key-bindings.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ __fzf_select() {
local item
FZF_DEFAULT_COMMAND=${FZF_CTRL_T_COMMAND:-} \
FZF_DEFAULT_OPTS=$(__fzf_defaults "--reverse --walker=file,dir,follow,hidden --scheme=path" "${FZF_CTRL_T_OPTS-} -m") \
FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd) "$@" < /dev/tty | while read item; do
echo -n "${(q)item} "
FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd) "$@" < /dev/tty | while read -r item; do
echo -n -E "${(q)item} "
done
local ret=$?
echo
Expand Down

0 comments on commit 69e1eed

Please sign in to comment.