Clear AI block find highlights when the find bar closes#11458
Conversation
a19cddd to
578c91a
Compare
|
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 clears cached find matches when closing the find bar so AI block highlights repaint immediately, and adds a regression test plus test-only accessors. The approach matches the intended behavior for the synchronous find path and includes visual evidence.
Concerns
- Closing the find bar now clears the async find controller through
clear_results, which also drops the saved activeFindOptions. WithAsyncFindenabled, reopening find no longer restores/reruns the previous query/options, unlike the sync path.
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
| // grid highlights are gated at paint time on `is_find_bar_open()`, | ||
| // but AI blocks are separate child views that won't repaint on | ||
| // their own when the find bar closes. | ||
| find_model.clear_matches(ctx); |
There was a problem hiding this comment.
clear_matches drops the active async find options via AsyncFindController::clear_results, so with AsyncFind enabled closing and reopening the find bar no longer restores/reruns the previous query. The sync cleared() path preserves options; make the async clear path preserve current_find_options/config or clear only rich-content highlights here.
`TerminalView::close_find_bar` only set `is_find_bar_open` to false and notified the terminal view itself. AI blocks are separate child views whose find highlights are gated on `is_find_bar_open()` at render time, but nothing notified them to repaint when the find bar closed, so stale highlights persisted until the pane was refocused. Terminal grid blocks were unaffected because the terminal view repaints itself on close. Add a new `TerminalFindModel::clear_rich_content_matches` that only notifies registered rich-content child views to drop their cached find state and repaint, without touching the active find run's options/config. `close_find_bar` calls it instead of the broader `clear_matches`, which on the async-find path routes through `AsyncFindController::clear_results` and drops `current_find_options` — losing the query that `open_find_bar` reads back via `active_find_options` to restore the previous search. Regression coverage: - `close_find_bar_clears_ai_block_find_highlights` (existing, sync path) - `close_find_bar_preserves_options_on_async_find_path` (new, async path) Fixes warpdotdev#11212
578c91a to
b32cf40
Compare
|
Addressed Oz's async-path concern (commit The previous revision called Fix: added Regression coverage:
/oz-review |
|
I'm re-reviewing this pull request in response to a review request. You can view the conversation on Warp. I reviewed this pull request and requested human review from: Comment Powered by Oz |
Oz no longer requests changes for this pull request after the latest automated review.
There was a problem hiding this comment.
Overview
This PR clears cached AI block find state when the terminal find bar closes, preserving async-find options so reopening find restores the previous query. It also adds focused regression coverage for the AI block highlight clearing behavior and the async-find query preservation path.
Concerns
No blocking correctness, security, or spec-alignment concerns found. Visual evidence is included in the PR description for this user-facing behavior change.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Summary
Closing the find bar left stale find highlights on AI blocks until the pane was refocused.
close_find_barnow clears find matches so AI block child views repaint immediately. Fixes #11212.Root cause
TerminalView::close_find_bar(app/src/terminal/view.rs) only setis_find_bar_opentofalseand calledctx.notify()on the terminal view itself. AI block find highlights are gated onis_find_bar_open()at render time (app/src/ai/blocklist/block/view_impl.rs), but AI blocks are separate child views — nothing notified them to repaint when the find bar closed, so their last-rendered highlights persisted until another repaint (e.g. pane refocus). Terminal grid blocks were unaffected because the terminal view repaints itself on close.Fix
close_find_barnow also callsfind_model.clear_matches(). That clears each registered rich-content child view's cached find state and notifies it to repaint — mirroring howopen_find_barruns find on open. Both the sync (clear_matches) and async (clear_results) find paths already iterate registered rich-content views, so the fix covers both.Tests
Added
close_find_bar_clears_ai_block_find_highlightsinapp/src/terminal/view_tests.rs: builds an AI block with a searchable query, highlights a match, closes the find bar, and asserts the AI block's find match count drops to0. The test fails before this change (highlights persist,left: 1, right: 0) and passes after.cargo fmt --check,cargo clippy --tests -D warnings, and the test all pass locally.The test drives the AI block's
run_finddirectly because the blocklist find pipeline only visits rich-content views once they have been laid out, which does not happen in a headless test; this is noted in a comment in the test.Visual evidence
Before (stable v0.2026.05.20.09.21.stable_03) — highlights persist after closing find bar until pane refocus:
11212_A.mov
After (this PR) — highlights clear immediately on close:
11212_B.mov
Scope
close_find_baris touched; opening find and live find updates are unchanged.#[cfg(test)]accessors (FindState::match_count,AIBlock::find_match_count) exist solely so the regression test can observe AI block find state.CHANGELOG-BUG-FIX: Fixed find highlights lingering on AI blocks after closing the find bar.