Skip to content

fix(terminal): close stale classic completion menu after backspacing past original prefix#13682

Open
Jason-Shen2 wants to merge 1 commit into
warpdotdev:masterfrom
Jason-Shen2:fix/classic-completions-stale-after-backspace
Open

fix(terminal): close stale classic completion menu after backspacing past original prefix#13682
Jason-Shen2 wants to merge 1 commit into
warpdotdev:masterfrom
Jason-Shen2:fix/classic-completions-stale-after-backspace

Conversation

@Jason-Shen2

Copy link
Copy Markdown
Contributor

Summary

With Classic Completions enabled, pressing Tab to open the completion menu and then backspacing past the original prefix left the stale suggestion list on screen. The result set was computed for a different query than what was in the input, and backspacing to an empty prefix re-showed the entire original result set.

Root Cause

The TODO in update_tab_completion_menu (app/src/terminal/input.rs:11646) called this out explicitly: the staleness check that closes the menu when text_up_to_cursor no longer starts with the original buffer text was gated by && !self.is_classic_completions_enabled(ctx), so classic completions never invalidated stale results.

This exception was added because cycling through fuzzy matches could temporarily put non-prefix text in the buffer. However, the active-cycling case was already handled by a separate check (current_selected_item == current_word), which came after the staleness check and was therefore unreachable when the buffer diverged from the original prefix.

Fix

Restructure update_tab_completion_menu to:

  1. Compute current_word early.
  2. Check the active-cycling case before the staleness check so Tab cycling keeps the menu open in classic mode.
  3. Run the staleness check in both classic and non-classic modes, removing the exception that prevented stale-result closure.
  4. Flatten the control flow (no more if/else nesting).

This preserves Tab cycling behavior while properly closing the menu when the user edits away from the original prefix, matching the non-classic completions behavior.

Fixes #13605

Test plan

  • Enabled classic completions mode.
  • In a directory with Documents/ and Downloads/, typed cd Do → Tab → Backspace repeatedly.
  • Verified that backspacing past the original Do prefix closes the stale completion menu.
  • Verified that Tab cycling between Documents/ and Downloads/ still works correctly.
  • Verified that continued typing after Tab (e.g. cd Doc) still filters results correctly.

CHANGELOG-BUG-FIX: Classic completions menu now properly closes when backspacing past the original query prefix instead of showing stale results.

…past original prefix

Resolve the TODO in update_tab_completion_menu: when classic completions
are enabled and the user backspaces past the original query prefix, the
cached suggestions were being kept on screen even though they were based
on a different query.

Restructure the staleness check to run in both classic and non-classic
modes, after first checking for the active cycling case (selected item
matches current word). This preserves Tab cycling behavior while properly
closing the menu when the user edits away from the original prefix.

Fixes warpdotdev#13605
@cla-bot cla-bot Bot added the cla-signed label Jul 13, 2026
@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Jul 13, 2026
@oz-for-oss

oz-for-oss Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@Jason-Shen2

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR updates classic tab completion menu invalidation so stale completion results close after the input no longer starts with the original completion prefix, while preserving active Tab cycling when the selected item matches the current word. I did not find code correctness, security, or spec-drift issues in the attached diff.

Concerns

  • For this user-facing completion-menu behavior change, please include screenshots or a short screen recording demonstrating it working end to end. The PR description includes manual test steps, but repository review guidance requires visual evidence for user-visible behavior changes.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Classic completions remain stale after Tab then Backspace

1 participant