[PR #5620] [MERGED] Hide the commandline on a resize to prevent a crash when snapping the window #26385

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/5620
Author: @zadjii-msft
Created: 4/28/2020
Status: Merged
Merged: 4/30/2020
Merged by: @undefined

Base: masterHead: dev/migrie/b/1856-for-real


📝 Commits (3)

📊 Changes

3 files changed (+96 additions, -28 deletions)

View changed files

📝 src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp (+86 -26)
📝 src/host/getset.cpp (+8 -0)
📝 src/inc/test/CommonState.hpp (+2 -2)

📄 Description

Hide any commandline (cooked read) we have before we begin a resize, and
show it again after the resize.

References

  • I found #5618 while I was working on this.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Basically, during a resize, we try to restore the viewport position
correctly, and part of that checks where the current commandline ends.
However, when we do that, the commandline's current state still
reflects the old buffer size, so resizing to be smaller can cause us
to throw an exception, when we find that the commandline doesn't fit in
the new viewport cleanly.

By hiding it, then redrawing it, we avoid this problem entirely. We
don't need to perform the check on the old commandline contents (since
they'll be empty), and we'll redraw it just fine for the new buffer size

Validation Steps Performed

  • ran tests
  • checked resizing, snapping in conhost with a cooked read
  • checked resizing, snapping in the Terminal with a cooked read

🔄 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/5620 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 4/28/2020 **Status:** ✅ Merged **Merged:** 4/30/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/migrie/b/1856-for-real` --- ### 📝 Commits (3) - [`14fe652`](https://github.com/microsoft/terminal/commit/14fe652f3e94aa14cb08894f116751abda21fb63) This is the test for #1856 - [`0d6dba5`](https://github.com/microsoft/terminal/commit/0d6dba53c556bb107a32abbb5b1df461a13990d8) This is the fix for #1856 - [`f294def`](https://github.com/microsoft/terminal/commit/f294defc3fc97400636659d7689623a543830112) add a resizing helper that will force you to do the right thing ### 📊 Changes **3 files changed** (+96 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp` (+86 -26) 📝 `src/host/getset.cpp` (+8 -0) 📝 `src/inc/test/CommonState.hpp` (+2 -2) </details> ### 📄 Description Hide any commandline (cooked read) we have before we begin a resize, and show it again after the resize. ## References * I found #5618 while I was working on this. ## PR Checklist * [x] Closes #1856 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments Basically, during a resize, we try to restore the viewport position correctly, and part of that checks where the current commandline ends. However, when we do that, the commandline's _current_ state still reflects the _old_ buffer size, so resizing to be smaller can cause us to throw an exception, when we find that the commandline doesn't fit in the new viewport cleanly. By hiding it, then redrawing it, we avoid this problem entirely. We don't need to perform the check on the old commandline contents (since they'll be empty), and we'll redraw it just fine for the new buffer size ## Validation Steps Performed * ran tests * checked resizing, snapping in conhost with a cooked read * checked resizing, snapping in the Terminal with a cooked read --- <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:15:44 +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#26385