fix(terminal): close stale classic completion menu after backspacing past original prefix#13682
Conversation
…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
|
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 Powered by Oz |
There was a problem hiding this comment.
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
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 whentext_up_to_cursorno 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_menuto:current_wordearly.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
Documents/andDownloads/, typedcd Do→ Tab → Backspace repeatedly.Doprefix closes the stale completion menu.Documents/andDownloads/still works correctly.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.