Skip to content

editor: Preserve active search match on panel open - #2953

Open
hlcfan wants to merge 2 commits into
longbridge:mainfrom
hlcfan:fix-search-next-jump
Open

editor: Preserve active search match on panel open#2953
hlcfan wants to merge 2 commits into
longbridge:mainfrom
hlcfan:fix-search-next-jump

Conversation

@hlcfan

@hlcfan hlcfan commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Description

Preserve the active editor search occurrence when Find is closed and reopened with the same query.

An unchanged query now keeps the matcher’s current index and is not re-anchored to the viewport. New queries and case-sensitivity changes still rebuild and anchor the search normally. This also prevents the styled search panel’s initial query synchronization from resetting the occurrence.

Screenshot

Before

Before.mov

After

After.mov

How to test

  1. Search for a term with at least three matches.
  2. Navigate to the second match and close Find.
  3. Reopen Find without changing the query.
  4. Confirm the counter remains at 2/3 and Next advances to 3/3.
cargo test -p gpui-base input::search::tests
cargo test -p gpui-component input::overlay::tests

AI assistance: Codex generated the implementation and regression tests; I reviewed changes.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI-generated code (if any) is accurate.
  • Passed cargo run for story tests related to the changes.
  • Platform-specific performance testing is not applicable; this is platform-independent search state synchronization.

@hlcfan hlcfan closed this Sep 4, 2026
@hlcfan hlcfan changed the title editor: Preserve active search match on panel open editor: Keep search match navigation in sync Sep 4, 2026
@hlcfan hlcfan changed the title editor: Keep search match navigation in sync editor: Preserve active search match on panel open Sep 4, 2026
@hlcfan hlcfan reopened this Sep 5, 2026
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