Repository navigation
fix: open fzf in an unclosed quote string - #605
Open
al-bashkir wants to merge 2 commits into
Open
al-bashkir wants to merge 2 commits into
al-bashkir wants to merge 2 commits into
Conversation
With complete_in_word, compstate[unambiguous] holds the whole word, including the text after the cursor. The early exit compared it with the text before the cursor only, so it always inserted the unchanged word and fzf never opened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
al-bashkir
force-pushed
the
fix/open-quote-unambiguous
branch
from
November 23, 2026 05:22
f175cfe to
e02dcb6
Compare
In `tst "foo bar<Tab>` with matches `foo bar1` and `foo bar2`, zsh sets compstate[unambiguous] to `"foo bar`, with no closing quote. The fast-path check compares it with `"foo bar"` (since Aloxaf#448), finds a difference and inserts the same text again, so fzf never opens. Compare with and without the closing quote. Builds on Aloxaf#603: the compared word keeps its $SUFFIX$ISUFFIX, and a test covers an unclosed quote with text after the cursor.
al-bashkir
force-pushed
the
fix/open-quote-unambiguous
branch
from
November 23, 2026 05:23
e02dcb6 to
c80cdb1
Compare
al-bashkir
marked this pull request as ready for review
November 24, 2026 04:50
njhoffman
added a commit
to njhoffman/fzf-tab
that referenced
this pull request
Nov 27, 2026
…AUDE.md: gh -R for the fork Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
njhoffman
added a commit
to njhoffman/fzf-tab
that referenced
this pull request
Nov 27, 2026
…among them (PR Aloxaf#582); fast-path tests that run the checks - lib/ftb-switch-group: upstream PR Aloxaf#582's per-style loop (bold, underline, reverse) with the fork's italic; lib/-ftb-fzf accepts reverse. Any combination works; none wins. - test: the case-twins tests ran under `menu true` from earlier cases, so zsh never inserted and the fast path's checks never ran. With menu unset, a new case (A/xaaa, a/xaaa) fails without the twins check; the flat twins need either it or Aloxaf#576's segment check. PR Aloxaf#605's two unclosed-quote cases added (they fail with the fast path forced open). - TODO: the three items done; the open upstream PRs the fork carries are watched in the recurring upstream check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Inside a quote that is not closed yet, Tab never opens fzf when the word already equals the common prefix of the matches. Each Tab inserts the same text again and nothing else happens.
The usual way to get there is one Tab earlier:
tst foo<Tab>with a completer that adds quoted matches writes"foo bar, and the next Tab is stuck.Why
In this state zsh sets
compstate[unambiguous]to"foo bar, with no closing quote. Since #448, the fast-path check compares it with the word plus a closing quote, which is"foo bar". The two differ, so fzf-tab takes the fast path (compstate[insert]=unambiguous), and zsh inserts text that is already on the line.#448 covers the case where the closing quote is already on the line (
tst ".#"<Tab>). Thencompstate[unambiguous]has the closing quote too. This PR compares with and without the closing quote, so both cases work. On top of #603 the line is:When the word is not quoted,
compstate[quote]is empty and the check is the same as before.Tests
Two new cases in
test/fzftab.ztst, after #603's case:unambiguous prefix in unclosed quote string: fails onmasterand on fix: open fzf when the word continues after the cursor #603 (the line staystst "foo bar), passes with this PR.unambiguous prefix in unclosed quote string with suffix after cursor(tst "foo barx, cursor beforex): fails on fix: open fzf when the word continues after the cursor #603 alone (the line staystst "foo barwithxafter the cursor), passes with this PR. It checks that the two fixes work together.The full
fzftab.ztstpasses with zsh 5.9. I did not run the binary-module pass on my machine (no autoconf here), but this change is in-ftb-complete, which is the same code in both passes.Relation to #597
The first guard in #597 (skip the fast path when the word already starts with
compstate[unambiguous]) also makes the first new test pass. #597 changes the lines around this one, so whichever of the two is merged second needs a small rebase. The tests in this PR still apply after #597.🤖 Generated with Claude Code