editor: Autoscroll to initial selection on select all matches edit#49232
Merged
dinocosta merged 3 commits intozed-industries:mainfrom Mar 27, 2026
Merged
Conversation
* Improve the documentation on `Editor::select_all_matches` to make it a little bit clearer why we're actually pushing the initial range last. * Update the existing `test_select_all_matches_does_not_scroll` test in order to also verify the case where the selections are not reversed.
dinocosta
approved these changes
Mar 27, 2026
Member
dinocosta
left a comment
There was a problem hiding this comment.
Thank you for suggesting this fix @Ben-Vollrath ! 🙂
I've pushed a smaller commit refactoring a small part of the code and update an existing test to actually catch the bug that is being fixed. Shipping! 🚀
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #32894
Summary
Adjust Select All Matches autoscroll behavior so that when a fit-based strategy can’t keep all selections on screen and we fall back to
newest, we scroll to the initial selection that triggeredselect_all_matchesinstead of the very last one.Design decision
The most intuitive behavior is to keep the user oriented around the initial selection:
This takes into account the feedback on PR #42009. This implements a fixed version of the first idea.
Implementation details
new_selectionslast, so it receives the highest selection id.newestfallback uses the highest id (seeautoscroll.rs), so when fit fails and the logic falls back tonewest, it scrolls to the initial selection, not the very last match.Release Notes:
editor: select all matcheswould scroll to the last match