terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Fix search constantly triggering a scroll

Open lhecker opened this issue 1 year ago • 3 comments

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 ✅

lhecker avatar Apr 25 '24 16:04 lhecker

the build is highly imploded, so I may not review it yet ;P

DHowett avatar Apr 25 '24 17:04 DHowett

/azp run

DHowett avatar Apr 26 '24 00:04 DHowett

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Apr 26 '24 00:04 azure-pipelines[bot]