Skip to content

fix: open fzf when the word continues after the cursor - #603

Draft
degnbol wants to merge 1 commit into
Aloxaf:masterfrom
degnbol:fix-unambiguous-suffix
Draft

degnbol wants to merge 1 commit into
Aloxaf:masterfrom
degnbol:fix-unambiguous-suffix

Conversation

@degnbol

@degnbol degnbol commented Nov 13, 2026

Copy link
Copy Markdown

With complete_in_word, Tab inside a word that has several matches does nothing: fzf never opens, and pressing Tab again repeats the no-op.

Reproduce (zsh -f, only compinit, setopt complete_in_word, fzf-tab):

touch ab1x ab2x
ls ab|x    # cursor between b and x, press Tab

Expected: fzf with ab1x, ab2x (what zsh lists with disable-fzf-tab). Actual: nothing.

Cause: compstate[unambiguous] holds the whole word, including the text after the cursor (abx). The early exit in -ftb-complete compares it with $IPREFIX$PREFIX (ab), so it always looks like there is a prefix to insert. It then inserts the unchanged word and returns.

Fix: include $SUFFIX$ISUFFIX in the comparison. Adds a ztst case, "unambiguous prefix with suffix after cursor". The suite passes.

Possibly related: #456.

🤖 Generated with Claude Code

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>
njhoffman added a commit to njhoffman/fzf-tab that referenced this pull request Nov 22, 2026
… picker (upstream PR Aloxaf#603)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
al-bashkir pushed a commit to al-bashkir/fzf-tab that referenced this pull request Nov 23, 2026
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 added a commit to al-bashkir/fzf-tab that referenced this pull request Nov 23, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant