Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore virtual viewport position after resize with reflow (#13087)
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
- Loading branch information