Skip to content

readline: support kitty keyboard protocol#62186

Open
jechol wants to merge 1 commit intonodejs:mainfrom
jechol:kitty-keyboard-protocol-support
Open

readline: support kitty keyboard protocol#62186
jechol wants to merge 1 commit intonodejs:mainfrom
jechol:kitty-keyboard-protocol-support

Conversation

@jechol
Copy link

@jechol jechol commented Mar 10, 2026

Summary

  • fix Node REPL and readline key handling when VS Code's integrated terminal uses kitty keyboard protocol
  • add kitty CSI-u key parsing to the readline keypress decoder
  • enable kitty keyboard protocol automatically for terminal readline sessions and restore legacy mode on close
  • add a tty.WriteStream#setKeyboardProtocol() API plus regression coverage

This is intended to address the regression where in the VS Code integrated terminal stops handling keys like Backspace and Ctrl+C correctly once kitty keyboard protocol is enabled. VS Code 1.109 release notes call out that kitty keyboard support is available to all users, which makes the readline/REPL incompatibility user-visible in the default terminal experience.

Reference: https://code.visualstudio.com/updates/v1_109

Testing

  • python3 tools/test.py test/parallel/test-readline-keys.js
  • python3 tools/test.py test/parallel/test-readline-emit-keypress-events.js
  • python3 tools/test.py test/parallel/test-readline-set-raw-mode.js

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. readline Issues and PRs related to the built-in readline module. tty Issues and PRs related to the tty subsystem. labels Mar 10, 2026
@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 86.61972% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.64%. Comparing base (ae228c1) to head (42441a1).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/readline/utils.js 90.09% 10 Missing ⚠️
lib/tty.js 67.85% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62186      +/-   ##
==========================================
- Coverage   89.65%   89.64%   -0.01%     
==========================================
  Files         676      676              
  Lines      206546   206669     +123     
  Branches    39558    39584      +26     
==========================================
+ Hits       185179   185274      +95     
- Misses      13485    13517      +32     
+ Partials     7882     7878       -4     
Files with missing lines Coverage Δ
lib/internal/readline/interface.js 97.42% <100.00%> (+0.08%) ⬆️
lib/tty.js 91.83% <67.85%> (-4.00%) ⬇️
lib/internal/readline/utils.js 97.19% <90.09%> (-1.15%) ⬇️

... and 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

needs-ci PRs that need a full CI run. readline Issues and PRs related to the built-in readline module. tty Issues and PRs related to the tty subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants