[PR #13052] Make sure the virtual viewport doesn't go negative #29362

Open
opened 2026-01-31 09:34:27 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/13052

State: closed
Merged: Yes


Summary of the Pull Request

When calculating the position of the virtual bottom after a resize with
reflow, it was possible for it to end up less than the height of the
viewport. This meant that the top of the virtual viewport would be
negative, which resulted in other operations failing further down the
line. This PR updates the virtual bottom calculation to fix that
scenario.

References

This was probably a regression introduced in PR #12972.

PR Checklist

Validation Steps Performed

I wasn't able to replicate the exact case described in issue #13034,
because I don't have Windows 11, so can't configure the default
terminal. However, I was able to reproduce a similar failure using a
SetConsoleScreenBufferInfoEx call, and I've confirmed that this PR
has fixed that.

I've also added another screen buffer test to make sure the
ResizeWithReflow method doesn't shrink the virtual bottom when
resizing at the top of the buffer.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/13052 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request When calculating the position of the virtual bottom after a resize with reflow, it was possible for it to end up less than the height of the viewport. This meant that the top of the virtual viewport would be negative, which resulted in other operations failing further down the line. This PR updates the virtual bottom calculation to fix that scenario. ## References This was probably a regression introduced in PR #12972. ## PR Checklist * [x] Closes #13034 * [x] CLA signed. * [x] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [x] I've discussed this with core contributors already. Issue number where discussion took place: #13034 ## Validation Steps Performed I wasn't able to replicate the exact case described in issue #13034, because I don't have Windows 11, so can't configure the default terminal. However, I was able to reproduce a similar failure using a `SetConsoleScreenBufferInfoEx` call, and I've confirmed that this PR has fixed that. I've also added another screen buffer test to make sure the `ResizeWithReflow` method doesn't shrink the virtual bottom when resizing at the top of the buffer.
claunia added the pull-request label 2026-01-31 09:34:27 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29362