[PR #17132] Fix search constantly triggering a scroll #31127

Closed
opened 2026-01-31 09:45:17 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/17132

State: closed
Merged: Yes


This addresses a review comment left by tusharsnx in #17092 which I
forgot to fix before merging the PR. The fix itself is somewhat simple:
Terminal::SetSearchHighlightFocused triggers a scroll if the target
is outside of the current (scrolled) viewport and avoiding the call
unless necessary fixes it. To do it properly though, I've split up
Search::ResetIfStale into IsStale and Reset. Now we can properly
detect staleness in advance and branch out the search reset cleanly.

Additionally, I've taken the liberty to replace the IVector in
SearchResultRows with a direct const std::vector& into Searcher.
This removes a bunch of code and makes it faster to boot.

Validation Steps Performed

  • Print lots of text
  • Search a common letter
  • Scroll up
  • Doesn't scroll back down
  • Hold enter to search more occurrences scrolls up as needed
  • showMarksOnScrollbar still works
**Original Pull Request:** https://github.com/microsoft/terminal/pull/17132 **State:** closed **Merged:** Yes --- This addresses a review comment left by tusharsnx in #17092 which I forgot to fix before merging the PR. The fix itself is somewhat simple: `Terminal::SetSearchHighlightFocused` triggers a scroll if the target is outside of the current (scrolled) viewport and avoiding the call unless necessary fixes it. To do it properly though, I've split up `Search::ResetIfStale` into `IsStale` and `Reset`. Now we can properly detect staleness in advance and branch out the search reset cleanly. Additionally, I've taken the liberty to replace the `IVector` in `SearchResultRows` with a direct `const std::vector&` into `Searcher`. This removes a bunch of code and makes it faster to boot. ## Validation Steps Performed * Print lots of text * Search a common letter * Scroll up * Doesn't scroll back down ✅ * Hold enter to search more occurrences scrolls up as needed ✅ * `showMarksOnScrollbar` still works ✅
claunia added the pull-request label 2026-01-31 09:45:17 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31127