Skip to content

Update win32-input-mode to preserve standard keys and signals #19576

@unxed

Description

@unxed

Description of the new feature

Description of the new feature / enhancement

I propose a refinement to the win32-input-mode (enabled via ^[[?9001h), originally introduced in spec 4999.

Currently, when this mode is active, all keyboard input is converted into generated CSI sequences (^[[Vk;Sc;Uc;Kd;Cs;Rc_). I request a modification (or a sub-parameter) to make this mode behave as a progressive enhancement, similar to how the kitty keyboard protocol or standard VT behavior works:

  1. Standard printable characters should remain as plain text.
  2. Standard signals (like Ctrl+C) should be sent as signals/bytes (SIGINT/\x03), not as escape sequences.
  3. Only complex keys (which cannot be represented by standard VT, e.g., Ctrl+Space, Shift+Enter, independent modifier presses, KeyUp events) should use the win32-input-mode encoding.

Why is this needed? (The "Bricked Terminal" Problem)

This request is directly motivated by the refusal of shell maintainers (specifically fish-shell) to support the current protocol.

As discussed in fish-shell issue #11877, the current "all-or-nothing" approach creates a critical reliability issue:

"It also appears to send every key in the new encoding... so if it remains turned on (e.g. because of a crash in a program that turns it on), it renders the session unusable." — @faho (fish-shell maintainer)

The Scenario:

  1. A user launches a tool that enables win32-input-mode.
  2. The tool crashes or hangs without properly disabling the mode.
  3. The user is dropped back into the shell.
  4. The terminal becomes unusable. The user cannot type reset to fix the terminal, because the shell receives complex escape sequences instead of the characters r, e, s, e, t. Even Ctrl+C is sent as a sequence, effectively preventing the user from interrupting the hung state via standard means.

Because of this risk, generic shells are unlikely to adopt win32-input-mode in its current form.

Current Adoption vs Potential

The protocol is already valuable and is used by specialized applications like:

  • far2l (Linux port of Far Manager 2)
  • turbo (TUI text editor)

However, wider adoption in the ecosystem (shells like fish, zsh, bash, and other CLI tools) depends on safety. If win32-input-mode sent standard keys as-is, it would allow shells to support rich input scenarios (like Ctrl+Alt+? or Shift+Enter bindings) without the risk of breaking the session in case of a crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Needs-Tag-FixDoesn't match tag requirementsNeeds-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions