Alternate console buffers of different sizes confuse ConPTY (and therefore Windows Terminal) #6185

Open
opened 2026-01-31 00:31:50 +00:00 by claunia · 2 comments
Owner

Originally created by @jwlodek on GitHub (Jan 28, 2020).

Environment

Microsoft Windows [Version 10.0.18362.535]
Version: 0.8.10261.0

Steps to reproduce

  1. Open a TUI application in Windows Terminal.
  2. Resize the Terminal Window
  3. Close the TUI application

The resulting terminal window acts like it is the original size before resizing, but the resized area remains visible.

For reference, the TUI application I was testing is a command line 2048 game: https://github.com/jwlodek/py_cui_2048
It can be installed with pip for python3:

pip install py_cui_2048
py2048

Expected behavior

When performing the same steps in cmd the terminal is resized back to its original size after resize and TUI application closed. This is also the case for a standalone powershell window.

Actual behavior

The window does seem to internally resize, but the extra space is still drawn. Please see video below for visual example:

TUIResizeBug

Originally created by @jwlodek on GitHub (Jan 28, 2020). <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ``` Microsoft Windows [Version 10.0.18362.535] Version: 0.8.10261.0 ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> 1. Open a TUI application in Windows Terminal. 2. Resize the Terminal Window 3. Close the TUI application The resulting terminal window acts like it is the original size before resizing, but the resized area remains visible. For reference, the TUI application I was testing is a command line 2048 game: https://github.com/jwlodek/py_cui_2048 It can be installed with pip for python3: ``` pip install py_cui_2048 py2048 ``` # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> When performing the same steps in `cmd` the terminal is resized back to its original size after resize and TUI application closed. This is also the case for a standalone `powershell` window. # Actual behavior <!-- What's actually happening? --> The window does seem to internally resize, but the extra space is still drawn. Please see video below for visual example: ![TUIResizeBug](https://user-images.githubusercontent.com/29227305/73313018-1b10c480-41f8-11ea-82b0-d0d84d6e910d.gif)
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 31, 2020):

This is an interesting one we'll have to think about. It looks like py2048 is using an alternate console buffer (not the VT alt buffer(!)), which has a different size.

@DHowett-MSFT commented on GitHub (Jan 31, 2020): This is an interesting one we'll have to think about. It looks like py2048 is using an alternate console buffer (**not** the VT alt buffer(!)), which has a different size.
Author
Owner

@jwlodek commented on GitHub (Jan 31, 2020):

If it helps, py2048 uses the windows-curses python module for rendering to the terminal, which is (to the best of my knowledge) a windows port of the traditional UNIX curses. I use the version downloadable with pip but it can be found on github here:
https://github.com/zephyrproject-rtos/windows-curses

@jwlodek commented on GitHub (Jan 31, 2020): If it helps, `py2048` uses the `windows-curses` python module for rendering to the terminal, which is (to the best of my knowledge) a windows port of the traditional UNIX `curses`. I use the version downloadable with `pip` but it can be found on github here: https://github.com/zephyrproject-rtos/windows-curses
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6185