mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-25 13:06:00 +03:00
[PR #421] [CLOSED] fix(windows): handle Ctrl+C gracefully with ConPTY terminal restoration #523
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#523
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/421
Author: @Hona
Created: 12/16/2025
Status: ❌ Closed
Base:
main← Head:fix/winterm-ctrl+c-rawmode📝 Commits (3)
96d7bbafix(windows): handle Ctrl+C gracefully with ConPTY terminal restoratione83d79aUpdate lib.zigec7db10Update lib.zig📊 Changes
1 file changed (+140 additions, -0 deletions)
View changed files
📝
packages/core/src/zig/lib.zig(+140 -0)📄 Description
On Windows with ConPTY (Windows Terminal), Ctrl+C triggers CTRL_C_EVENT at the Windows API level, but ConPTY does not pass the 0x03 byte through to stdin. This caused immediate process termination without giving the TUI a chance to restore terminal state (exit alternate screen, disable raw mode, etc.).
Add SetConsoleCtrlHandler to intercept CTRL_C_EVENT and inject 0x03 into stdin via WriteConsoleInputW, allowing the existing graceful shutdown code path to execute.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.