From 14e16f0d36ae9938e28b2f6efdb7344cd527a1a6 Mon Sep 17 00:00:00 2001 From: Aloxaf Date: Wed, 12 Jun 2024 13:52:43 +0800 Subject: [PATCH] fix: prefix completion in quoted string (#448) * fix: prefix completion in quote string close #447 * add test --- fzf-tab.zsh | 3 +-- test/fzftab.ztst | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fzf-tab.zsh b/fzf-tab.zsh index ee77101..9ca1e04 100644 --- a/fzf-tab.zsh +++ b/fzf-tab.zsh @@ -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 diff --git a/test/fzftab.ztst b/test/fzftab.ztst index 7023016..de4ae49 100644 --- a/test/fzftab.ztst +++ b/test/fzftab.ztst @@ -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