Skip to content

feat: dynamic newline shortcuts based on terminal capabilities#930

Merged
rumpl merged 2 commits intodocker:mainfrom
benodiwal:fix/improve-shift-enter
Nov 25, 2025
Merged

feat: dynamic newline shortcuts based on terminal capabilities#930
rumpl merged 2 commits intodocker:mainfrom
benodiwal:fix/improve-shift-enter

Conversation

@benodiwal
Copy link
Copy Markdown
Contributor

Closes #871

Tested on iTerm, Ghostty, and default Mac Terminal to verify the behavior across different terminal capabilities.

Hey @rumpl, I have some thoughts regarding the implementation after working on this issue. I've implemented keyboard enhancement detection as suggested, listening to tea.KeyboardEnhancementsMsg, checking msg.Flags, and dynamically configuring shortcuts.

However, during implementation I discovered a terminal protocol limitation: even with keyboard enhancements enabled (Flags != 0), terminals like iTerm send shift+enter as ctrl+j without preserving the shift modifier (debug shows: Key="ctrl+j", Mod=4 (ModCtrl), ShiftMod=false), making them indistinguishable at the protocol level. Given this reality, the implementation shows both "shift+enter / ctrl+j" in the status bar for modern terminals (since both work due to the protocol mapping) and only "ctrl+j" for legacy terminals.

This approach matches what Claude Code, Gemini, and other modern terminal applications do, they acknowledge both shortcuts work in enhanced terminals rather than artificially restricting to one when the terminal protocol
doesn't allow true separation.

@dgageot
Copy link
Copy Markdown
Member

dgageot commented Nov 25, 2025

cc @rumpl

@rumpl
Copy link
Copy Markdown
Member

rumpl commented Nov 25, 2025

Tested, works, thanks <3

@rumpl rumpl merged commit 8a1f68b into docker:main Nov 25, 2025
5 checks passed
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.

Improve implementation of shift-enter

3 participants