Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

test(tui): match leftover #524 cases to #707 CSI-only Alt

Cursor Agentf2d68341a4c2
diff --git a/TUI/key_orphan.zig b/TUI/key_orphan.zig
index 28e9a117..4ee5523a 100644
--- a/TUI/key_orphan.zig
+++ b/TUI/key_orphan.zig
@@ -551,7 +551,9 @@ test "a join only happens when the tail really completes the head" {
try std.testing.expect(completes("\x1b", "]11;rgb:14/14/14\x07"));
try std.testing.expect(completes("\x1b", "[200~payload"));
try std.testing.expect(completes("\x1b\x1b", "[D"));
- try std.testing.expect(completes("\x1b", "\x1b[D"));
+ // A delivered lone Escape must not rejoin onto a later ESC CSI — that
+ // first ESC already cancelled or resolved as Escape (#707).
+ try std.testing.expect(!completes("\x1b", "\x1b[D"));
try std.testing.expect(completes("\x1b\x1b", "OA"));
try std.testing.expect(completes("\x1b[<35;80", ";24M"));
try std.testing.expect(completes("\x1b[201", "~"));
diff --git a/TUI/key_tests.zig b/TUI/key_tests.zig
index ba12d43f..6b1261cb 100644
--- a/TUI/key_tests.zig
+++ b/TUI/key_tests.zig
@@ -87,7 +87,9 @@ test "ESC ESC CSI is Alt+arrow, not Escape (#524)" {
i = 0;
try std.testing.expectEqual(Key.down, next("\x1b\x1b[B", &i).?);
i = 0;
- try std.testing.expectEqual(Key.up, next("\x1b\x1bOA", &i).?);
+ // SS3 is not a legacy Alt prefix — only ESC ESC CSI is. The first ESC
+ // is Escape; the OA is a later SS3 up.
+ try std.testing.expectEqual(Key.escape, next("\x1b\x1bOA", &i).?);
}
test "kitty release events never fire keys" {