mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-24 20:45:56 +03:00
[PR #555] fix(core): recognize Ctrl+Backspace on Windows Terminal and WSL #616
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#616
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/555
Author: @Info-Cado
Created: 1/19/2026
Status: 🔄 Open
Base:
main← Head:fix/ctrl-backspace-windows📝 Commits (3)
e452a1ffix(core): recognize Ctrl+Backspace on Windows Terminal and WSL18363d7fix(core): use platform detection for backspace handling91d10f2fix(core): detect WSL environment for Ctrl+Backspace handling📊 Changes
2 files changed (+92 additions, -8 deletions)
View changed files
📝
packages/core/src/lib/parse.keypress.test.ts(+63 -4)📝
packages/core/src/lib/parse.keypress.ts(+29 -4)📄 Description
Summary
delete-word-backwardon Windows Terminal and WSLProblem
Windows Terminal and WSL terminals send different byte sequences for backspace:
\x7f(ASCII 127, DEL)\b(ASCII 8)The current parser treats both as plain backspace without setting
ctrl: true, so keybindings likectrl+backspace→delete-word-backwardnever trigger.Additional WSL Complexity
In WSL,
process.platformreturns'linux', not'win32', even though Windows Terminal sends Windows-style key sequences. This required detecting WSL via environment variables (WSL_DISTRO_NAME,WSL_INTEROP).Solution
Added
isWindowsTerminal()helper that detects:process.platform === 'win32')WSL_DISTRO_NAMEorWSL_INTEROPenvironment variables)\bHandling{ name: "backspace", ctrl: true }{ name: "h", ctrl: true }Testing
isWindowsTerminal()helper for platform-aware assertionsFixes anomalyco/opencode#6991
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.