[PR #15998] Avoid moving the selection while typing a search query #30797

Open
opened 2026-01-31 09:43:01 +00:00 by claunia · 0 comments
Owner

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

State: closed
Merged: Yes


This commit fixes 2 issues:

  • ControlCore::ScrollMarks() would call ResetIfStale
    again while the search prompt hasn't changed.
    This has been fixed by using _cachedSearchResultRows as
    the indicator for whether it needs to be recreated or not.
  • While typing a search query, the selection would move among the
    results with each typed character, because MovePastCurrentSelection
    would do what its name indicates. It has been renamed and rewritten
    to be MoveToCurrentSelection. To avoid breaking UIA, the previous
    MovePastPoint implementation was kept.

Since the new MoveToCurrentSelection function would not move past the
current selection anymore, changing the direction would not move past
the current result either. To fix this, we now don't invalidate the
search cache when changing the direction.

Closes #15954

Validation Steps Performed

  • Run "helloworld`n"*20 in pwsh
  • Search for "helloworld"
  • While typing the characters the selection doesn't move
  • ...nor when searching downwards
  • ...nor when erasing parts of it
  • ...and it behaves identical in conhost
**Original Pull Request:** https://github.com/microsoft/terminal/pull/15998 **State:** closed **Merged:** Yes --- This commit fixes 2 issues: * `ControlCore::ScrollMarks()` would call `ResetIfStale` again while the search prompt hasn't changed. This has been fixed by using `_cachedSearchResultRows` as the indicator for whether it needs to be recreated or not. * While typing a search query, the selection would move among the results with each typed character, because `MovePastCurrentSelection` would do what its name indicates. It has been renamed and rewritten to be `MoveToCurrentSelection`. To avoid breaking UIA, the previous `MovePastPoint` implementation was kept. Since the new `MoveToCurrentSelection` function would not move past the current selection anymore, changing the direction would not move past the current result either. To fix this, we now don't invalidate the search cache when changing the direction. Closes #15954 ## Validation Steps Performed * Run ``"helloworld`n"*20`` in pwsh * Search for "helloworld" * While typing the characters the selection doesn't move ✅ * ...nor when searching downwards ✅ * ...nor when erasing parts of it ✅ * ...and it behaves identical in conhost ✅
claunia added the pull-request label 2026-01-31 09:43:01 +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#30797