fix(tui): preserve kitty event reporting mode

This commit is contained in:
can1357
2026-08-02 20:53:36 +02:00
parent ce7d037240
commit c6b282bc68
2 changed files with 25 additions and 3 deletions
+3 -3
View File
@@ -1100,9 +1100,9 @@ export class ProcessTerminal implements Terminal {
const reportedFlags = parseInt(match[1]!, 10);
this.#kittyProtocolActive = true;
setKittyProtocolActive(true);
if (reportedFlags >= 3) {
// Already enriched (Ghostty/foot may keep flags from a parent app).
// Push level-2 to lock in event reporting.
if ((reportedFlags & 2) !== 0) {
// Preserve event-type reporting already enabled by a parent app.
// Push level-2 to keep its shortcuts reporting consistently.
this.#kittyEnableSeq = "\x1b[>7u";
this.#safeWrite(this.#kittyEnableSeq);
} else {
@@ -60,6 +60,28 @@ describe("ProcessTerminal kitty keyboard progressive-enhancement ordering", () =
expect(out).not.toContain("\x1b[>4;2m");
});
it("keeps alternate-key reporting without enabling event types after a previous session", async () => {
harness = createProcessTerminalRenderHarness(100, 30);
await harness.settle();
harness.writes.length = 0;
await harness.feed("\x1b[?5u");
const out = harness.writes.join("");
expect(out).toContain("\x1b[>5u");
expect(out).not.toContain("\x1b[>7u");
});
it("preserves event-type reporting enabled by a parent app", async () => {
harness = createProcessTerminalRenderHarness(100, 30);
await harness.settle();
harness.writes.length = 0;
await harness.feed("\x1b[?3u");
expect(harness.writes.join("")).toContain("\x1b[>7u");
});
it("enables kitty when the DA1 sentinel arrives before the kitty reply (#2042)", async () => {
harness = createProcessTerminalRenderHarness(100, 30);
await harness.settle();