mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-24 20:45:56 +03:00
[PR #357] [MERGED] feat: add kitty event types #1259
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#1259
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/357
Author: @melMass
Created: 11/28/2025
Status: ✅ Merged
Merged: 11/28/2025
Merged by: @kommander
Base:
main← Head:fix-kittykb-release📝 Commits (2)
dac941bfeat: add kitty event typesb16f23cfeat(solid): ✨ add keyboard event options to useKeyboard hook📊 Changes
5 files changed (+175 additions, -3 deletions)
View changed files
📝
packages/core/src/lib/parse.keypress-kitty.test.ts(+44 -0)📝
packages/core/src/lib/parse.keypress-kitty.ts(+85 -0)📝
packages/core/src/renderer.ts(+1 -1)📝
packages/core/src/zig/terminal.zig(+25 -1)📝
packages/solid/src/elements/hooks.ts(+20 -1)📄 Description
For a nodegraph I'm prototyping in opentui I needed multiple key handling.
I'm using the solid flavor and the useKeyboard hook, looking into it I realized it was only listening keypress, tracing it up and using the raw renderer
keyInputI wasn't receiving the release at all.AI Summary (double checked/corrected)
Why this matters
Key release detection enables:
Without release events, apps can only react to key presses one at a time with no way to know when a key is let go.
Problem
The Kitty Keyboard Protocol requires specific flags to report event types:
We were only enabling bit 0, so terminals never sent release events.
Additionally, arrow keys use a "legacy" format (
CSI 1;modifiers:event_type LETTER) that wasn't being parsed.Changes
Enable event type reporting
kitty_keyboard_flagsfrom0b00001to0b00011in both Zig and TSParse legacy arrow key format
parseKittyLegacy()to handle sequences like\x1b[1;1:3A(up arrow release)CSI 1;modifiers:event_type LETTERwhere:Improve Kitty keyboard capability detection
CSI ? N uresponse pattern (sent by Ghostty, etc.)Enhanced
useKeyboardhook (solid)releaseflag to include release eventsrepeatflag to include repeat eventse.eventTypeto differentiateExample
BEFORE
https://github.com/user-attachments/assets/1323ce3f-f094-4691-8dda-a45aa2fa8bd1
AFTER
using
{release:true}(so no repeat), repeat only repeat the last keypress if multiple are selectedhttps://github.com/user-attachments/assets/3b573fa5-3c66-432b-8207-05bb745c9324
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.