Skip to content

feat: add ReportAllKeysAsEscapeCodes keyboard enhancement option (#1621)#1622

Open
neomantra wants to merge 1 commit intocharmbracelet:mainfrom
neomantra:nm-escape
Open

feat: add ReportAllKeysAsEscapeCodes keyboard enhancement option (#1621)#1622
neomantra wants to merge 1 commit intocharmbracelet:mainfrom
neomantra:nm-escape

Conversation

@neomantra
Copy link
Copy Markdown

Some terminals send modified printable keys (e.g. Shift+Space) as raw character bytes on press, losing modifier information. This adds support for requesting Kitty keyboard protocol flag 8 (ReportAllKeysAsEscapeCodes), which ensures all keys are sent as CSI u-escape codes that preserve modifier state.

Add --all-keys argument to keyboard-enhancements demo to exercise it.

I used Claude to navigate the surface of this issue, so I don't have a strong understanding of the Kitty protocol and the ramifications of this change. I couldn't find reference to KittyReportAllKeysAsEscapeCodes on Discord or GitHub.

That said, when I enable this, many messages are flowing in the keyboard-enhancements demo when v.KeyboardEnhancements.ReportAllKeysAsEscapeCodes = true:

$ go run examples/keyboard-enhancements/main.go --all-keys
release: enter
  press: rightshift
release: rightshift
  press: leftshift
release: leftshift
  press: leftshift
  press: shift+space
release: shift+space
  press: shift+space
release: shift+space
  press: shift+space
release: shift+space
release: leftshift

…rmbracelet#1621)

Some terminals send modified printable keys (e.g. Shift+Space) as raw
character bytes on press, losing modifier information. This adds support
for requesting Kitty keyboard protocol flag 8 (ReportAllKeysAsEscapeCodes),
which ensures all keys are sent as CSI u-escape codes that preserve modifier state.

Add --all-keys argument to keyboard-enhancements demo to exercise it.

Signed-off-by: Evan Wies <evan@neomantra.net>
aymanbagabas added a commit that referenced this pull request Mar 14, 2026
This adds support for the Kitty keyboard protocol's extended
enhancements, allowing applications to request that the terminal report
additional information about key events, such as whether they're part of
a repeat sequence, alternate key values, and associated text.

Supersedes: #1622
Fixes: #1621
Fixes: #1623
aymanbagabas added a commit that referenced this pull request Apr 7, 2026
This adds support for the Kitty keyboard protocol's extended
enhancements, allowing applications to request that the terminal report
additional information about key events, such as whether they're part of
a repeat sequence, alternate key values, and associated text.

Supersedes: #1622
Fixes: #1621
Fixes: #1623
@aymanbagabas
Copy link
Copy Markdown
Member

Hi @neomantra, I've merged #1626 and the changes will be available in the next Bubble Tea v2 release. In the meantime, you could go get charm.land/bubbletea/v2@main if you want to get the patch right away. Happy hacking 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants