Skip to content

Commit

Permalink
fix: prefix completion in quoted string (#448)
Browse files Browse the repository at this point in the history
* fix: prefix completion in quote string

close #447

* add test
  • Loading branch information
Aloxaf authored Jun 12, 2024
1 parent c7fb028 commit 14e16f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions fzf-tab.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,10 @@ builtin unalias -m '[^+]*'
fi
;;
*)

if (( ! _ftb_continue_last )) \
&& [[ $compstate[insert] == *"unambiguous" ]] \
&& [[ -n $compstate[unambiguous] ]] \
&& [[ "$compstate[unambiguous]" != "$IPREFIX$PREFIX" ]]; then
&& [[ "$compstate[unambiguous]" != "$compstate[quote]$IPREFIX$PREFIX$compstate[quote]" ]]; then
compstate[list]=
compstate[insert]=unambiguous
_ftb_finish=1
Expand Down
9 changes: 9 additions & 0 deletions test/fzftab.ztst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@
0:unambiguous prefix
>line: {: dir}{}

comptesteval '_tst() { compadd ".#abc" ".#def" ".#hij" }'
comptest $'tst ".#"\t'
0:unambiguous prefix in quote string
>line: {tst ".#abc }{"}
>QUERY:{.#}
>C0:{.#abc}
>C0:{.#def}
>C0:{.#hij}

comptesteval '_tst() { compadd /home /usr /lib; compstate[insert]=menu }'
comptest $'tst \t'
0:force list
Expand Down

0 comments on commit 14e16f0

Please sign in to comment.