From cf4f55af3620f22c6e29db2d834c7a3643f9c239 Mon Sep 17 00:00:00 2001 From: roboomp Date: Wed, 15 Jul 2026 21:30:11 +0000 Subject: [PATCH] fix(tui): restored modifyOtherKeys fallback in tmux Removed the blanket tmux exclusion from shouldEnableModifyOtherKeysFallback that forced every non-Kitty tmux pane into legacy keyboard input, collapsing Ctrl+H into Backspace and Shift+Enter into Enter even under extended-keys on. tmux gates the CSI > 4 ; 2 m request on its own extended-keys setting, so it remains the capability gate: honoring the request when on/always and ignoring it when off. The #5502 gate never fixed #5378 (input still wedged in 16.5.2 from a read-side cause) and only caused this key regression. Updated the DA1-under-tmux negotiation test to assert the fallback engages. Fixes #5620 --- packages/tui/CHANGELOG.md | 4 ++++ packages/tui/src/terminal.ts | 2 -- .../tui/test/kitty-keyboard-da1-ordering.test.ts | 12 +++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/tui/CHANGELOG.md b/packages/tui/CHANGELOG.md index 9f9a2831d..c5653d833 100644 --- a/packages/tui/CHANGELOG.md +++ b/packages/tui/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Fixed + +- Fixed a tmux regression where every non-Kitty pane was forced into legacy keyboard input, collapsing Ctrl+H into Backspace and Shift+Enter into Enter even with `extended-keys on`; the xterm modifyOtherKeys fallback is requested again so tmux honors or ignores it per its own `extended-keys` setting ([#5620](https://github.com/can1357/oh-my-pi/issues/5620)). + ## [17.0.0] - 2026-07-15 ### Added diff --git a/packages/tui/src/terminal.ts b/packages/tui/src/terminal.ts index 695757cb9..41b7bc764 100644 --- a/packages/tui/src/terminal.ts +++ b/packages/tui/src/terminal.ts @@ -13,7 +13,6 @@ import { setKittyProtocolActive } from "./keys"; import { StdinBuffer } from "./stdin-buffer"; import { isInsideTerminalMultiplexer, - isInsideTmux, NotifyProtocol, setCellDimensions, setOsc99Supported, @@ -45,7 +44,6 @@ export function resolveHangulCompatibilityJamoWidthFromTerminalIdentity( } function shouldEnableModifyOtherKeysFallback(env: NodeJS.ProcessEnv = Bun.env): boolean { - if (isInsideTmux(env)) return false; if (!env.SSH_CONNECTION && !env.SSH_TTY && !env.SSH_CLIENT) return true; return TERMINAL.id !== "base" && TERMINAL.id !== "trueColor"; } diff --git a/packages/tui/test/kitty-keyboard-da1-ordering.test.ts b/packages/tui/test/kitty-keyboard-da1-ordering.test.ts index 300e16d1c..42662f4eb 100644 --- a/packages/tui/test/kitty-keyboard-da1-ordering.test.ts +++ b/packages/tui/test/kitty-keyboard-da1-ordering.test.ts @@ -112,7 +112,12 @@ describe("ProcessTerminal kitty keyboard progressive-enhancement ordering", () = expect(harness.terminal.keyboardEnhancementEnterSequence).toBeNull(); }); - it("keeps legacy keyboard input under tmux when kitty is unavailable", async () => { + it("enables modifyOtherKeys fallback under tmux so extended-keys panes keep modified keys (#5620)", async () => { + // tmux answers DA1 but not `CSI ? u`. omp must still request the xterm + // modifyOtherKeys fallback; tmux honors it under `extended-keys on`/`always` + // (delivering Ctrl+H and Shift+Enter distinctly) and ignores it under + // `extended-keys off`, so tmux — not omp — is the capability gate. A blanket + // tmux exclusion (#5502) collapsed those keys to legacy bytes in every pane. Bun.env.TMUX = "/tmp/tmux-501/default,1234,0"; delete Bun.env.SSH_CONNECTION; delete Bun.env.SSH_TTY; @@ -125,8 +130,9 @@ describe("ProcessTerminal kitty keyboard progressive-enhancement ordering", () = const out = harness.writes.join(""); expect(harness.terminal.kittyProtocolActive).toBe(false); - expect(out).not.toContain("\x1b[>4;2m"); - expect(harness.terminal.keyboardEnhancementEnterSequence).toBeNull(); + expect(out).toContain("\x1b[>4;2m"); + expect(out).not.toContain("\x1b[>1u"); + expect(harness.terminal.keyboardEnhancementEnterSequence).toBe("\x1b[>4;2m"); }); it("reasserts modifyOtherKeys fallback when fullscreen overlays enter the alternate screen", async () => {