Maintain scrollbar position during a resize operation#4903
Merged
5 commits merged intomasterfrom Mar 16, 2020
Merged
Conversation
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
We won't be able to clear the one failed build, so I'm going to admin merge this when it's time. |
DHowett-MSFT
approved these changes
Mar 13, 2020
carlos-zamora
approved these changes
Mar 13, 2020
Member
carlos-zamora
left a comment
There was a problem hiding this comment.
Mostly some spelling nits but I'll approve it so you can just fix them up and merge it.
| TextBuffer& newBuffer, | ||
| const std::optional<Microsoft::Console::Types::Viewport> lastCharacterViewport, | ||
| std::optional<short>& oldViewportTop); | ||
| std::optional<std::reference_wrapper<PositionInformation>> positionInfo); |
Member
There was a problem hiding this comment.
Suggested change
| std::optional<std::reference_wrapper<PositionInformation>> positionInfo); | |
| std::optional<std::reference_wrapper<PositionInformation>> positionInfo = std::nullopt); |
I think you can do it for the lastCharacterViewport parameter too.
Then the call you have in screenInfo doesn't have two std::nullopts passed through.
Up to you tho
Co-Authored-By: Carlos Zamora <[email protected]>
Co-Authored-By: Carlos Zamora <[email protected]>
|
Hello @zadjii-msft! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
This pull request was closed.
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.
Summary of the Pull Request
Currently, when the user resizes the Terminal, we'll snap the visible viewport back to the bottom of the buffer. This PR changes the visible viewport of the Terminal to instead remain in the same relative location it was before the resize.
References
Made possible by our sponsors at #4741, and listeners like you.
PR Checklist
Detailed Description of the Pull Request / Additional comments
We already hated the
std::optional<short>&thing I yeet'd into #4741 right at the end to replace ashort*. So I was already going to change that to astd::optional<std::reference_wrapper<short>>, which is more idomatic. But then I was looking through the list of bugs and #3494 caught my eye. I realized it would be trivial to not only track the top of themutableViewportduring a resize, but we could use the same code path to track the visible viewport's start as well.So basically I'm re-using that bit of code in
Reflowto calculate the visible viewport's position too.Validation Steps Performed
Gotta love just resizing things all day, errday