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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/13052
Author: @j4james
Created: 5/7/2022
Status: Merged
Merged: 5/9/2022
Merged by: @undefined

Base: mainHead: fix-virtual-viewport


📝 Commits (2)

  • bf710e2 Make sure virtual viewport doesn't go negative.
  • 2cc3add Add another virtual bottom unit test.

📊 Changes

2 files changed (+35 additions, -2 deletions)

View changed files

📝 src/host/screenInfo.cpp (+5 -2)
📝 src/host/ut_host/ScreenBufferTests.cpp (+30 -0)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/13052 **Author:** [@j4james](https://github.com/j4james) **Created:** 5/7/2022 **Status:** ✅ Merged **Merged:** 5/9/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `fix-virtual-viewport` --- ### 📝 Commits (2) - [`bf710e2`](https://github.com/microsoft/terminal/commit/bf710e2bd928469713ccf4bf46bb3c8f91a113c7) Make sure virtual viewport doesn't go negative. - [`2cc3add`](https://github.com/microsoft/terminal/commit/2cc3add925fe5cdce123ce5cb5320715612132c6) Add another virtual bottom unit test. ### 📊 Changes **2 files changed** (+35 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/host/screenInfo.cpp` (+5 -2) 📝 `src/host/ut_host/ScreenBufferTests.cpp` (+30 -0) </details> ### 📄 Description ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:34:25 +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#29357