Repository navigation
Preserve Find match scrolling when closing the widget - #350820
Open
smolpupperino wants to merge 2 commits into
Open
smolpupperino wants to merge 2 commits into
smolpupperino wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
With Replace expanded in a short editor, the pending scroll still includes the removed top zone’s offset, which can leave the selected match above the viewport.
1 open issue
What changed in this PR
Addresses #215722 by preventing Find widget closure from cancelling an in-progress scroll to the selected match.
Changes:
- Skips the top view-zone scroll adjustment while an animation is pending, retaining stationary behavior.
- Adds a browser regression test that navigates to an off-screen match, closes Find, and checks visibility after scrolling.
| File | Description |
|---|---|
src/vs/editor/contrib/find/test/browser/findController.test.ts |
Adds a regression test using a real editor view. |
src/vs/editor/contrib/find/browser/findWidget.ts |
Guards the scroll adjustment during view-zone removal. |
Review effort: Balanced
Comment on lines
+733
to
+734
| if (!this._codeEditor.hasPendingScrollAnimation()) { | ||
| this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() - this._viewZone.heightInPx); |
Author
|
@microsoft-github-policy-service agree |
Author
|
Fixed in b5bffcb. Closing Find now compensates both the current scroll position and the pending destination for the removed zone. The new short-editor test uses an interior match with Replace expanded. It fails with the previous implementation, and all 29 Find controller tests pass in Chromium with the fix. |
This branch has not been deployed
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.

Fixes #215722.
When
editor.action.nextMatchFindActionstarts a smooth scroll andcloseFindWidgetimmediately removes the Find widget's top view zone, setting the scroll position cancels the animation. Skip that adjustment while a scroll animation is pending so the selected match can come into view. Keep the existing scroll adjustment when the viewport is stationary.Added a browser regression test that opens Find, advances to an off-screen match, closes Find, and checks that the match is visible after scrolling. The test fails on the unchanged widget. With the fix, all 83 Find browser tests pass in Chromium, and both changed files pass
oxlint.Prepared with Codex assistance.