Repository navigation
Commit d59d1a1
authored
editor: Preserve active search match on panel open (longbridge#2953)
## 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
https://github.com/user-attachments/assets/4f334ada-27f8-4a17-8ad3-5b768aff058b
After
https://github.com/user-attachments/assets/3ef1f5ae-1c56-4829-9f49-87513ef5a039
## 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`.
```sh
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
- [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) 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.
- [x] Platform-specific performance testing is not applicable; this is
platform-independent search state synchronization.1 parent 9d9bd9b commit d59d1a1
2 files changed
Lines changed: 80 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
92 | 103 | | |
93 | | - | |
| 104 | + | |
94 | 105 | | |
95 | 106 | | |
96 | 107 | | |
| |||
404 | 415 | | |
405 | 416 | | |
406 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
407 | 435 | | |
408 | 436 | | |
409 | 437 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
507 | 546 | | |
508 | 547 | | |
509 | 548 | | |
| |||
0 commit comments