-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Restore virtual viewport position after resize with reflow #13087
Conversation
Hello @DHowett! Because this pull request has the Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 8 hours, a condition that will be fulfilled in about 35 minutes. No worries though, I will be back when the time is right! 😉 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 (
|
@msftbot merge this in 1 minute |
Hello @DHowett! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
When the buffer is resized with a reflow, we were previously calculating the new virtual bottom based on the position of last non-space character. If the viewport was largely blank when resized, this could result in the new virtual bottom being higher than it should be. This PR attempts to address that problem by restoring the virtual bottom to a position that is the same distance from the cursor row as it was prior to the resize. This was a regression introduced in PR #12972. We still take the last non-space row into account when determining the virtual bottom, because if the content of the screen is forced to wrap, the virtual bottom will need to be lower (relative to the cursor) than it was before. We also need to check that we don't overflow the bottom of the buffer, which can occur when the viewport is at the bottom of the buffer, and the cursor position is pushed down as a result of content wrapping above it. I've manually confirmed that this fixes the problem reported in issue #13078, and I've also extended the existing `RefreshWithReflow` unit test to cover that particular scenario. Closes #13078 (cherry picked from commit c2f8308) Service-Card-Id: 81864034 Service-Version: 1.14
🎉 Handy links: |
When the buffer is resized with a reflow, we were previously calculating
the new virtual bottom based on the position of last non-space
character. If the viewport was largely blank when resized, this could
result in the new virtual bottom being higher than it should be.
This PR attempts to address that problem by restoring the virtual bottom
to a position that is the same distance from the cursor row as it was
prior to the resize.
This was a regression introduced in PR #12972.
We still take the last non-space row into account when determining the
virtual bottom, because if the content of the screen is forced to wrap,
the virtual bottom will need to be lower (relative to the cursor) than
it was before.
We also need to check that we don't overflow the bottom of the buffer,
which can occur when the viewport is at the bottom of the buffer, and
the cursor position is pushed down as a result of content wrapping above
it.
I've manually confirmed that this fixes the problem reported in issue
#13078, and I've also extended the existing
RefreshWithReflow
unittest to cover that particular scenario.
Closes #13078