mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-25 06:07:42 +00:00
[zsh-completion] Fix error with backslash-prefixed commands
Fix #1973 Fix #1974 Fix #1975
This commit is contained in:
parent
5deaf58928
commit
dea206b023
@ -117,6 +117,7 @@ __fzf_extract_command() {
|
||||
local token tokens
|
||||
tokens=(${(z)1})
|
||||
for token in $tokens; do
|
||||
token=${(Q)token}
|
||||
if [[ "$token" =~ [[:alnum:]] && ! "$token" =~ "=" ]]; then
|
||||
echo "$token"
|
||||
return
|
||||
@ -275,7 +276,7 @@ fzf-completion() {
|
||||
|
||||
tail=${LBUFFER:$(( ${#LBUFFER} - ${#trigger} ))}
|
||||
# Kill completion (do not require trigger sequence)
|
||||
if [ $cmd = kill -a ${LBUFFER[-1]} = ' ' ]; then
|
||||
if [ "$cmd" = kill -a ${LBUFFER[-1]} = ' ' ]; then
|
||||
matches=$(command ps -ef | sed 1d | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-50%} --min-height 15 --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS --preview 'echo {}' --preview-window down:3:wrap" __fzf_comprun "$cmd" -m | awk '{print $2}' | tr '\n' ' ')
|
||||
if [ -n "$matches" ]; then
|
||||
LBUFFER="$LBUFFER$matches"
|
||||
|
@ -2133,6 +2133,18 @@ class TestZsh < TestBase
|
||||
tmux.send_keys "FZF_TMUX=1 #{Shell.zsh}", :Enter
|
||||
tmux.prepare
|
||||
end
|
||||
|
||||
def test_complete_quoted_command
|
||||
tmux.send_keys 'export FZFFOOBAR=BAZ', :Enter
|
||||
['unset', '\unset', "'unset'"].each do |command|
|
||||
tmux.prepare
|
||||
tmux.send_keys "#{command} FZFFOOBR**", :Tab
|
||||
tmux.until { |lines| lines.match_count == 1 }
|
||||
tmux.send_keys :Enter
|
||||
tmux.until { |lines| lines[-1].include?("#{command} FZFFOOBAR") }
|
||||
tmux.send_keys 'C-c'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TestFish < TestBase
|
||||
|
Loading…
Reference in New Issue
Block a user