-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
Bubbletea v2 does not detect terminal resize events on Windows. When the terminal window is resized, WindowSizeMsg is never sent to Update after the initial startup message. This is a regression from v1.
In v1, the readConInputs function in key_windows.go handled coninput.WindowBufferSizeEventRecord from the Windows Console API and converted it to WindowSizeMsg. In v2, the Windows input was switched to VT input mode (ENABLE_VIRTUAL_TERMINAL_INPUT in tty_windows.go), and the ConInput reader was dropped. VT input mode does not deliver WINDOW_BUFFER_SIZE_EVENT records, so resize events are lost.
The listenForResize in signals_windows.go is a no-op (Windows has no SIGWINCH), and there is no alternative resize detection mechanism to compensate.
Setup
- OS: Windows 11
- Shell: PowerShell 7 / Git Bash
- Terminal Emulator: Windows Terminal 1.23
- Terminal Multiplexer: none
- Go: 1.26
- Bubbletea: v2.0.0
To Reproduce
- Run any bubbletea v2 program that uses
AltScreenand displaysWindowSizeMsgdimensions - Resize the terminal window by dragging the edge
- Observe that
WindowSizeMsgis never received after the initial one at startup - The UI renders at the original size regardless of the new terminal dimensions
Expected behavior
Resizing the terminal window should deliver WindowSizeMsg to Update, as it did in v1. The renderer should also update its internal dimensions so the view is re-rendered at the correct size.
Additional context
Windows Terminal does deliver WINDOW_BUFFER_SIZE_EVENT through the Console API. The event is available β v2 just isn't listening for it anymore after the switch to VT input mode.