[PR #4964] [MERGED] Clamp the terminal buffer to SHRT_MAX on resize #26059

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/4964
Author: @zadjii-msft
Created: 3/17/2020
Status: ✅ Merged
Merged: 3/18/2020
Merged by: @undefined

Base: master ← Head: dev/migrie/b/2815-resize-SHRT_MAX


📝 Commits (3)

  • 6326673 Clamp the terminal buffer to SHRT_MAX on resize
  • 0dd055d Do clamped math the real way
  • 08f8053 order of operations can be really hard

📊 Changes

2 files changed (+116 additions, -68 deletions)

View changed files

📝 src/cascadia/TerminalCore/Terminal.cpp (+9 -7)
📝 src/cascadia/UnitTests_TerminalCore/ScreenSizeLimitsTest.cpp (+107 -61)

📄 Description

Summary of the Pull Request

This is 100% on me. Even after mucking around in this function for the last 3
months, I missed that there was a single addition where we weren't doing a
clamped addition. This would lead to us creating a buffer with negative height,
and all sorts of badness.

Clamping this addition was enough to fix the bug.

PR Checklist

Validation Steps Performed

  • ran tests
  • Created a profile with "historySize" : 32728, then filled the viewport with
    text, then maximized, and saw that the viewport indeed did resize to the new
    size of the window.

🔄 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/4964 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 3/17/2020 **Status:** ✅ Merged **Merged:** 3/18/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/migrie/b/2815-resize-SHRT_MAX` --- ### 📝 Commits (3) - [`6326673`](https://github.com/microsoft/terminal/commit/63266734ce997d4ac3ae1b0d1f4273e2f0eae99a) Clamp the terminal buffer to `SHRT_MAX` on resize - [`0dd055d`](https://github.com/microsoft/terminal/commit/0dd055d4290df1cfcb74c2b2b621d47e5e7c5e70) Do clamped math the real way - [`08f8053`](https://github.com/microsoft/terminal/commit/08f8053c6ef2d005c965ec1e614eab917b8dd58b) order of operations can be really hard ### 📊 Changes **2 files changed** (+116 additions, -68 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+9 -7) 📝 `src/cascadia/UnitTests_TerminalCore/ScreenSizeLimitsTest.cpp` (+107 -61) </details> ### 📄 Description ## Summary of the Pull Request This is 100% on me. Even after mucking around in this function for the last 3 months, I missed that there was a single addition where we weren't doing a clamped addition. This would lead to us creating a buffer with negative height, and all sorts of badness. Clamping this addition was enough to fix the bug. ## PR Checklist * [x] Closes #2815 * [x] Closes #4972 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed * ran tests * Created a profile with `"historySize" : 32728`, then filled the viewport with text, then maximized, and saw that the viewport indeed did resize to the new size of the window. --- <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:13:40 +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#26059