Fix Shift+Enter for multiline input in agent terminals

xterm.js sends plain \r for Enter regardless of modifiers. Intercept
modified Enter in the custom key handler so it routes through CSI u
encoding (Kitty keyboard protocol), which Claude Code uses for
Shift+Enter newlines.
This commit is contained in:
Mohamed Boudra
2026-04-12 22:10:16 +07:00
parent 609d11ee8d
commit 0095f61121
3 changed files with 81 additions and 1 deletions
@@ -317,7 +317,9 @@ export class TerminalEmulatorRuntime {
!shouldInterceptDomTerminalKey({
key: normalizedKey,
ctrlKey: event.ctrlKey,
shiftKey: event.shiftKey,
altKey: event.altKey,
metaKey: event.metaKey,
pendingModifiers: this.pendingModifiers,
})
) {