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
This commit is contained in:
roboomp
2026-07-15 21:30:11 +00:00
parent d5cd24f39a
commit cf4f55af36
3 changed files with 13 additions and 5 deletions
+4
View File
@@ -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
-2
View File
@@ -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";
}
@@ -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 () => {