summaryrefslogtreecommitdiff
path: root/dev/tui/tui.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 09:57:16 -0300
committerGabriel Schneider <[email protected]>2026-11-20 11:35:33 -0300
commitfe0efce585bdd001d15db3b7fee7bf125af4168f (patch)
tree6568915dae435cf209770f92635f8c8e67161807 /dev/tui/tui.zig
parent214839df238faa462de02274ef4322ea484cf383 (diff)
downloadpardes-fe0efce585bdd001d15db3b7fee7bf125af4168f.tar.gz
pardes-fe0efce585bdd001d15db3b7fee7bf125af4168f.zip
vaxis's parser (pardes's patch, build/patches.zig): an ESC read with a mouse report after it is the Escape key, then the report; the patch made an ESC before any CSI Alt on what followed, and on a mouse report, which has no Alt but in its button, it dropped the ESC: a busy session that read an Escape and the click after it in one read (or took the click within the 50 ms an ESC ending a longer read waits) kept the pane in insert mode (process-test exec-bigdrag's alive-ok: 3 of 9-21 runs at a load of 33-43, the pane's next i typed as text); dev/tui/tui.zig's test 'an Escape read with the click after it...' failed before (the mouse event came where the Escape was); after, pinned to one CPU: exec-bigdrag 0 of 30; the five together: tui core-test 859/1014, shell-test 1055/1058, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275 and --replay, process-test 0 of 144 (cmdexit once, again alone), daemon.py in every mode, both soaks diverged 0 unequal 0, gui unit-test 1651/1655 (BaselineHarnessMismatch), the frame and perf gate against tree2 PASS
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'dev/tui/tui.zig')
-rw-r--r--dev/tui/tui.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/dev/tui/tui.zig b/dev/tui/tui.zig
index 0157362a..e699745a 100644
--- a/dev/tui/tui.zig
+++ b/dev/tui/tui.zig
@@ -2446,6 +2446,22 @@ test "an ESC read by itself is the Escape key at once" {
t.vx.caps.kitty_keyboard = false;
}
+test "an Escape read with the click after it is the Escape key, then the click" {
+ var t: TestInput = undefined;
+ try t.init();
+ defer t.deinit();
+ // A busy session reads them in one: no terminal sends Alt on a mouse
+ // report as an ESC before it (it is in the report's button).
+ var reader: TestReader = .{ .parts = &.{"\x1b\x1b[<1;105;9M"} };
+ try readInput(&t.loop, &reader, &t.vx, &t.feed);
+ try std.testing.expectEqual(.winsize, std.meta.activeTag((try t.loop.tryEvent()).?));
+ const escape = (try t.loop.tryEvent()).?.key_press;
+ try std.testing.expectEqual(vaxis.Key.escape, escape.codepoint);
+ try std.testing.expect(!escape.mods.alt);
+ try std.testing.expectEqual(.mouse, std.meta.activeTag((try t.loop.tryEvent()).?));
+ try std.testing.expect(try t.loop.tryEvent() == null);
+}
+
test "a frame's answer is taken wherever the reads cut it, and never typed" {
const gpa = std.testing.allocator;
var t: TestInput = undefined;