mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
e3894eb850
* terminal: allow Shift+Enter text inside ConPTY Win32 input mode Win32 input mode (PR #3247) delivers Shift+Enter to ConPTY as a lossless INPUT_RECORD, which CLIs reading console records natively (Codex, Grok) can use. Node/Bun CLIs read input through libuv, which drops modifier state when translating INPUT_RECORD to VT bytes, so Claude Code and CodeBuddy still see a bare CR and submit instead of inserting a newline (anthropics/claude-code#92771, reproducing on 2.1.278). While the mode is active, Netcatty also skips its Shift+Enter text fallback and Kitty encoding, so shiftEnterNewlineText had no effect on local Windows sessions at all. Add shiftEnterForceText (default false): when enabled, Shift+Enter sends the configured text even inside Win32 input mode, and consumes the keydown so no native record is emitted as well. Add `\e` (ESC) to the escape decoder so the text can carry the legacy Alt+Enter encoding, which is the only sequence that survives the ConPTY input path. Defaults keep the #2974 behaviour untouched for Codex/Grok. * docs: record libuv input findings and the Win32 input mode opt-out * fix(terminal): don't swallow Shift+Enter when there is no text to send The Shift+Enter send-text interception resolved its text after already calling preventDefault/stopPropagation, and returned false outside the `if (shiftEnterText)` guard. When resolveShiftEnterText() yields an empty string (e.g. a persisted empty setting) the keydown was therefore consumed with nothing written, and the handler never fell through to the Win32 bookkeeping or Kitty paths below, so no Enter reached the session either. The result was indistinguishable from a dead feature. Resolve the text first and only enter the interception block when it is non-empty; empty text now falls through exactly as it did before the `shiftEnterForceText` setting existed, so a normal Enter is still produced. The opt-out semantics for the non-empty case are unchanged. Also tighten the source-shape test so it verifies the real intent: the interception (preventDefault through return false) must live inside the empty-text guard, which fails against the previous code. * fix(terminal): scope Shift+Enter force-text to Win32 mode, honor it per broadcast target Address review on #3464: - The force-text opt-out could override a negotiated Kitty encoding that preserves Shift+Enter in non-Win32 sessions. The keydown decision now lives in shouldClaimShiftEnterForText: under Win32 input mode it follows shiftEnterForceText, otherwise only the existing collapse fallback applies. Covered by a regression test for a non-Win32 session whose Kitty encoding already preserves the chord. - Broadcast Win32 targets returned the native record without consulting their own shiftEnterForceText. They now send their configured text for Shift+Enter when opted in, whether the source forwarded a key chord or a native Win32 record, and drop the paired release so ConPTY never sees a key-up without its key-down. Targets without the opt-out keep the native press/release pair. Tests cover source and target settings that differ. ShiftEnterEvent now accepts KittyKeyboardEvent's optional type/modifier fields so broadcast events can be checked with the same helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>