[zsh-completion] Fix quoting/splitting issues (#1820)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Chitoku · committed by Junegunn Choi · parent a1bcdc2 · Browse files · 1 file·+4 added−4 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+4 added−4 removed
- other:+4 added−4 removed
Provenance
- Commit
f7b26b3- Tree
61a0c48- Author
Chitoku <chitoku-k@users.noreply.github.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
a1bcdc2
1 file changed+4 added−4 removed
modified:shell/completion.zsh+4 added-4 removed
53 unmodified lines54 leftover=${base/#"$dir"}55 leftover=${leftover/#\/}56 [ -z "$dir" ] && dir='.'57 [ "$dir" != "/" ] && dir="${dir/%\//}"58- matches=$(eval "$compgen $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" ${=fzf} ${=fzf_opts} -q "$leftover" | while read item; do58+ matches=$(eval "$compgen $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" ${(Q)${(Z+n+)fzf}} ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" | while read item; do59 echo -n "${(q)item}$suffix "60 done)61 matches=${matches% }62 if [ -n "$matches" ]; then33 unmodified lines96 97 fzf="$(__fzfcmd_complete)"98 99 _fzf_feed_fifo "$fifo"100- matches=$(cat "$fifo" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" ${=fzf} ${=fzf_opts} -q "${(Q)prefix}" | $post | tr '\n' ' ')100+ matches=$(cat "$fifo" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" ${(Q)${(Z+n+)fzf}} ${(Q)${(Z+n+)fzf_opts}} -q "${(Q)prefix}" | $post | tr '\n' ' ')101 if [ -n "$matches" ]; then102 LBUFFER="$lbuf$matches"103 fi104 zle reset-prompt62 unmodified lines167 tail=${LBUFFER:$(( ${#LBUFFER} - ${#trigger} ))}168 # Kill completion (do not require trigger sequence)169 if [ $cmd = kill -a ${LBUFFER[-1]} = ' ' ]; then170 fzf="$(__fzfcmd_complete)"171- matches=$(command ps -ef | sed 1d | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-50%} --min-height 15 --reverse $FZF_DEFAULT_OPTS --preview 'echo {}' --preview-window down:3:wrap $FZF_COMPLETION_OPTS" ${=fzf} -m | awk '{print $2}' | tr '\n' ' ')171+ matches=$(command ps -ef | sed 1d | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-50%} --min-height 15 --reverse $FZF_DEFAULT_OPTS --preview 'echo {}' --preview-window down:3:wrap $FZF_COMPLETION_OPTS" ${(Q)${(Z+n+)fzf}} -m | awk '{print $2}' | tr '\n' ' ')172 if [ -n "$matches" ]; then173 LBUFFER="$LBUFFER$matches"174 fi175 zle reset-prompt4 unmodified lines180 [ -z "$trigger" ] && prefix=${tokens[-1]} || prefix=${tokens[-1]:0:-${#trigger}}181 [ -z "${tokens[-1]}" ] && lbuf=$LBUFFER || lbuf=${LBUFFER:0:-${#tokens[-1]}}182 183 if eval "type _fzf_complete_${cmd} > /dev/null"; then184- eval "prefix=\"$prefix\" _fzf_complete_${cmd} \"$lbuf\""184+ prefix="$prefix" eval _fzf_complete_${cmd} ${(q)lbuf}185 elif [ ${d_cmds[(i)$cmd]} -le ${#d_cmds} ]; then186 _fzf_dir_completion "$prefix" "$lbuf"187 else188 _fzf_path_completion "$prefix" "$lbuf"17 unmodified lines