Skip to content

Clear AI block find highlights when the find bar closes#11458

Draft
maxmilian wants to merge 1 commit into
warpdotdev:masterfrom
maxmilian:maxmilian/fix-11212-ai-block-find-highlight
Draft

Clear AI block find highlights when the find bar closes#11458
maxmilian wants to merge 1 commit into
warpdotdev:masterfrom
maxmilian:maxmilian/fix-11212-ai-block-find-highlight

Conversation

@maxmilian
Copy link
Copy Markdown
Contributor

Summary

Closing the find bar left stale find highlights on AI blocks until the pane was refocused. close_find_bar now clears find matches so AI block child views repaint immediately. Fixes #11212.

Root cause

TerminalView::close_find_bar (app/src/terminal/view.rs) only set is_find_bar_open to false and called ctx.notify() on the terminal view itself. AI block find highlights are gated on is_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_bar now also calls find_model.clear_matches(). That clears each registered rich-content child view's cached find state and notifies it to repaint — mirroring how open_find_bar runs 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_highlights in app/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 to 0. 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_find directly 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/after screen recording to be added before marking ready for review.

Scope

  • Only close_find_bar is touched; opening find and live find updates are unchanged.
  • The new #[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.

@cla-bot cla-bot Bot added the cla-signed label May 21, 2026
@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 21, 2026
`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.

Call `find_model.clear_matches()` from `close_find_bar` so every registered rich-content child view clears its cached find state and repaints, mirroring how `open_find_bar` runs find on open.

Fixes warpdotdev#11212

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@maxmilian maxmilian force-pushed the maxmilian/fix-11212-ai-block-find-highlight branch from a19cddd to 578c91a Compare May 22, 2026 01:06
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.

Find highlights on AI blocks persist after closing find bar

1 participant