[PR #2666] [MERGED] Don't crash when restor-down'ing the alt buffer #25025

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2666
Author: @zadjii-msft
Created: 9/5/2019
Status: Merged
Merged: 9/5/2019
Merged by: @zadjii-msft

Base: masterHead: dev/migrie/b/1206-restore-alt-crash


📝 Commits (4)

📊 Changes

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

View changed files

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

📄 Description

Summary of the Pull Request

When a user had "Disable Scroll Forward" enabled and switched to the alt buffer and maximized the console, then restored down, we'd crash. Now we don't.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

The problem is that we'd previously try to "anchor" the viewport to the virtual bottom when resizing like this. This would also cause us to move the top of the viewport down, into the buffer. However, if the alt buffer is getting smaller, we don't want to do this - if we anchor to the old _virtualBottom, the bottom of the viewport will actually be outside the current buffer.

This could theoretically happen with the main buffer too, but it's much easier to repro with the alt buffer.

Validation Steps Performed

Added tests.
Tried the original repro. Really went wild on the resizing.


🔄 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/2666 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 9/5/2019 **Status:** ✅ Merged **Merged:** 9/5/2019 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `master` ← **Head:** `dev/migrie/b/1206-restore-alt-crash` --- ### 📝 Commits (4) - [`051a7e3`](https://github.com/microsoft/terminal/commit/051a7e3a949881d1806c2d60414538a477683af7) This fixes the bug, but I don't know if I have a test for it quite yet - [`4e58187`](https://github.com/microsoft/terminal/commit/4e581870a6c5dd84fac4c6c181c4b503088b315e) add a test for #1206 - [`088e08d`](https://github.com/microsoft/terminal/commit/088e08df934aa66b670fca6fe0d09699e3df943b) Actually fix the test so it tests this - [`f286958`](https://github.com/microsoft/terminal/commit/f2869583b77e8422348e7712bd85ce534ec0074b) Add a comment ### 📊 Changes **2 files changed** (+71 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/host/screenInfo.cpp` (+5 -2) 📝 `src/host/ut_host/ScreenBufferTests.cpp` (+66 -0) </details> ### 📄 Description <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request When a user had "Disable Scroll Forward" enabled and switched to the alt buffer and maximized the console, then restored down, we'd crash. Now we don't. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #1206 * [x] I work here * [x] Tests added/passed <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments The problem is that we'd previously try to "anchor" the viewport to the virtual bottom when resizing like this. This would also cause us to move the top of the viewport down, into the buffer. However, if the alt buffer is getting smaller, we don't want to do this - if we anchor to the old _virtualBottom, the bottom of the viewport will actually be outside the current buffer. This could theoretically happen with the main buffer too, but it's much easier to repro with the alt buffer. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Added tests. Tried the original repro. Really went wild on the resizing. --- <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:06:47 +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#25025