[PR #15618] Fix VtEngine hang when resizing while scrolling #30689

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

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

State: closed
Merged: Yes


This fixes a bug reported internally that occurs when resizing the
terminal while also scolling the contents. The easiest way to reproduce
it is to resize the terminal to 0 rows, but it's much more prominent
in a debug build where everything goes out of sync almost immediately.

The underlying issue is that VtEngine::_wrappedRow may contain an
offset that is outside of the viewport bounds, because reflowing and
scrolling aren't properly synchronized. The previous bitmap code
would then throw an exception for such invalid coordinates and cause
the internal VtEngine state to be broken. Once _wrappedRow got
to a negative value at least once, it would stay that way unless you're
scrolling up. If the contents are actively scrolling it would quickly
reach a negative value from which it can never recover. At that point
OpenConsole would enter a tight exception-throw-catch-retry loop
and Windows Terminal seemingly cease to show any content.

Validation Steps Performed

  • Resize WT to the minimal window size repeatedly
  • Doesn't hang ✅
**Original Pull Request:** https://github.com/microsoft/terminal/pull/15618 **State:** closed **Merged:** Yes --- This fixes a bug reported internally that occurs when resizing the terminal while also scolling the contents. The easiest way to reproduce it is to resize the terminal to 0 rows, but it's much more prominent in a debug build where everything goes out of sync almost immediately. The underlying issue is that `VtEngine::_wrappedRow` may contain an offset that is outside of the viewport bounds, because reflowing and scrolling aren't properly synchronized. The previous `bitmap` code would then throw an exception for such invalid coordinates and cause the internal `VtEngine` state to be broken. Once `_wrappedRow` got to a negative value at least once, it would stay that way unless you're scrolling up. If the contents are actively scrolling it would quickly reach a negative value from which it can never recover. At that point OpenConsole would enter a tight exception-throw-catch-retry loop and Windows Terminal seemingly cease to show any content. ## Validation Steps Performed * Resize WT to the minimal window size repeatedly * Doesn't hang ✅
claunia added the pull-request label 2026-01-31 09:42:21 +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#30689