Skip to content

v2: windows terminal resize events not detected (regression from v1)Β #1601

@KiGamji

Description

@KiGamji

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

  1. Run any bubbletea v2 program that uses AltScreen and displays WindowSizeMsg dimensions
  2. Resize the terminal window by dragging the edge
  3. Observe that WindowSizeMsg is never received after the initial one at startup
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions