-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve Webview Scroll Position #26426
Conversation
@mjbvz, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jrieken and @joaomoreno to be potential reviewers. |
35329bf
to
cc5f3bf
Compare
cc5f3bf
to
1e937f2
Compare
Fixes #13256 |
@mjbvz The editor input can be used for multiple editors (e.g., through Split Editor). You probably want to store the scroll position separately from the input. See WalkThroughPart.load/saveTextEditorViewState() for a similar approach to what the BaseTextEditor and its subclasses do. |
Thanks for taking a look @chrmarti. I think I was actually closer to that behavior with my first draft of the implementation (which used private member on Let me try the memento based approach and see how that works |
What makes it harder than expected is that editors and inputs are both reused. Editors are reused for inputs of the same type in the same editor column IIRC. Switching between editor tabs in the same column can trigger setInput() calls on a single editor with different inputs. So one editor can cover multiple editor tabs. |
@chrmarti Thanks for the help. I prototyped the approach using mementos but I don't think it is correct here either, at least for the normal html preview. The scroll position should always be associated with the content, not just with the resource url. At present, we also do not want to restore the previous scroll position in an html preview after you restart VS Code The approach that saved view state on the |
dd42176
to
1e937f2
Compare
Fixes microsoft#22995 **Bug** If you switch away from an editor that users a webview, the scroll position is currently not preserved. This effects our release notes and the markdown preview. The root cause is that the webview is disposed of when the view is hidden. **Fix** Add some presisted state to track scrollProgress through the webview. Use this state in the standard html editor and in the release notes.
Fixes microsoft#22995 **Bug** If you switch away from an editor that users a webview, the scroll position is currently not preserved. This effects our release notes and the markdown preview. The root cause is that the webview is disposed of when the view is hidden. **Fix** Add some presisted state to track scrollProgress through the webview. Use this state in the standard html editor and in the release notes.
1e937f2
to
ac1d20b
Compare
8032c00
to
4309165
Compare
Ok, merging the initial memento based implementation as we discussed |
Fixes #22995
Bug
If you switch away from an editor that users a webview, the scroll position is currently not preserved. This effects our release notes and the markdown preview. The root cause is that the webview is disposed of when the view is hidden.
Fix
Add some presisted state to track scrollProgress through the webview. Use this state in the standard html editor and in the release notes.
TODO