From 699d4cbd4948250a7afe44cf6bd4f12e80d5c60d Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Tue, 4 Aug 2026 01:34:20 -0700 Subject: [PATCH] test(e2e): negotiate kitty via PTY output in the Ctrl+Enter spec The Ctrl+Enter gate reads the PTY-output kitty tracker, which enableKittyKeyboardReporting never feeds (it writes straight into xterm's parser), so the spec pressed the chord on a pane the policy still saw as un-negotiated and got the CR fallback. Negotiate from the application side like the neighbouring Shift+Enter spec, and reset the flags afterwards for the serial suite. Co-authored-by: Orca --- tests/e2e/terminal-shortcuts.spec.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/e2e/terminal-shortcuts.spec.ts b/tests/e2e/terminal-shortcuts.spec.ts index a72c2571cc5..c8f3a800a54 100644 --- a/tests/e2e/terminal-shortcuts.spec.ts +++ b/tests/e2e/terminal-shortcuts.spec.ts @@ -531,13 +531,26 @@ test.describe('Terminal Shortcuts', () => { electronApp }) => { await installMainProcessPtyWriteSpy(electronApp) - await waitForActivePanePtyId(orcaPage) + const ptyId = await waitForActivePanePtyId(orcaPage) // Why: a plain shell never negotiates kitty, so CSI-u would print verbatim (#12329). await pressAndExpectWrite(orcaPage, electronApp, 'Control+Enter', '\r') + if (process.platform === 'win32') { + return + } - await enableKittyKeyboardReporting(orcaPage, 31) + // Why: the gate reads the PTY-output tracker, not xterm's renderer-local flags, + // so negotiation has to come from the application side like a real TUI's. + await execInTerminal(orcaPage, ptyId, "printf '\\033[>1u'") + await expect.poll(() => getKittyKeyboardFlags(orcaPage)).toBe(1) await pressAndExpectWrite(orcaPage, electronApp, 'Control+Enter', '\x1b[13;5u') + + // Clear the shell's unconsumed CSI-u line before resetting flags in a settled + // command; otherwise its line editor can swallow the reset bytes. + await sendToTerminal(orcaPage, ptyId, '\x15\x03') + await execInTerminal(orcaPage, ptyId, "printf '\\033[=0u'") + await expect.poll(() => getKittyKeyboardFlags(orcaPage)).toBe(0) + await pressAndExpectWrite(orcaPage, electronApp, 'Control+Enter', '\r') }) test('plain Ctrl+C sends ETX under kitty keyboard reporting', async ({