[FEATURE] Support shift+enter via common control sequence identifiers
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Many users have issues with the "shift+enter" support because Claude Code currently relies on a terminal-level remapping of that input to instead provide an explicit newline character. This is necessary for the program to distinguish the remapped input from a normal enter keypress.
This requires the whole terminal-setup command, causes behavior that changes depending on which terminal you are running within, and the feature can be broken based on the user's modification of their own config files for other programs.
Proposed Solution
In other sophisticated TUI applications, distinguishing these inputs can be done with control sequence identifiers. This would greatly ease user onboarding, as many modern terminals are setup to use one of these two codes. (As an example, in a new terminal window run cat with no input and then press shift+enter to show the exact sequence identifier received over stdin)
The two codes that could support this ought to be:
- CSI u code for shift+enter:
^[[13;2u modifyOtherKeyscode for shift+enter:^[[27;2;13~
CSI u is from the extended keys format, is more widely supported and more modern, and would be a great starting point!
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
Interactive mode (TUI)
Use Case Example
_No response_
Additional Context
Attached is a screenshot of CSI u code for shift+enter on ghostty within Ubuntu.
<img width="172" height="140" alt="Image" src="https://github.com/user-attachments/assets/146cb0bd-3500-4fc9-befd-12364efd9eec" />
Additionally, more details can be found in my exploration within OpenCode: https://github.com/sst/opencode/issues/1505#issuecomment-3411334883
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗