summaryrefslogtreecommitdiff
path: root/test/snapshot.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/snapshot.zig')
-rw-r--r--test/snapshot.zig20
1 files changed, 15 insertions, 5 deletions
diff --git a/test/snapshot.zig b/test/snapshot.zig
index 31f2c8ea..aeb01187 100644
--- a/test/snapshot.zig
+++ b/test/snapshot.zig
@@ -40,7 +40,7 @@
// parses it as alt-<ch>. The scripts said 700ms and
// it cost the suite 28s; there is no timer in vaxis
// to outlast — 20ms passes, they use 100ms)
-// press|release <left|middle|right> <col> <row> SGR mouse, 1-based
+// press|release <[ctrl-]left|middle|right> <col> <row> SGR mouse, 1-based
// drag <btn> <col> <row> motion with button held
// motion <col> <row> button-less motion (hover)
// wheel <up|down> <col> <row>
@@ -307,6 +307,9 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const
_ = setenv("HOME", try arena.dupeZ(u8, home), 1);
_ = setenv("TERM", "xterm-256color", 1);
_ = setenv("LC_ALL", "C", 1);
+ // durations cannot live in a golden; the lsp introspection views print
+ // `-` for them when this is set (see lsp_zls.zig hideTime)
+ _ = setenv("PARDES_LSP_NOTIME", "1", 1);
// Pin the dump path: live runs use a timestamped file under the user data
// dir (dump.outPath), which would make the dump/load/restore goldens
// nondeterministic. Per-SCRIPT, not one shared /tmp/pardes-dump.zon: four
@@ -722,10 +725,10 @@ fn colorStr(color: ghostty_vt.Style.Color, buf: *[16]u8) []const u8 {
fn keyBytes(name: []const u8) ?[]const u8 {
const map = .{
- .{ "enter", "\r" }, .{ "esc", "\x1b" }, .{ "tab", "\t" },
- .{ "bs", "\x7f" }, .{ "space", " " }, .{ "up", "\x1b[A" },
- .{ "down", "\x1b[B" }, .{ "right", "\x1b[C" }, .{ "left", "\x1b[D" },
- .{ "home", "\x1b[H" }, .{ "end", "\x1b[F" }, .{ "pgup", "\x1b[5~" },
+ .{ "enter", "\r" }, .{ "esc", "\x1b" }, .{ "tab", "\t" },
+ .{ "bs", "\x7f" }, .{ "space", " " }, .{ "up", "\x1b[A" },
+ .{ "down", "\x1b[B" }, .{ "right", "\x1b[C" }, .{ "left", "\x1b[D" },
+ .{ "home", "\x1b[H" }, .{ "end", "\x1b[F" }, .{ "pgup", "\x1b[5~" },
.{ "pgdn", "\x1b[6~" },
};
inline for (map) |e| if (std.mem.eql(u8, name, e[0])) return e[1];
@@ -749,7 +752,14 @@ fn keyBytes(name: []const u8) ?[]const u8 {
return null;
}
+/// SGR button code, with an optional `ctrl-` prefix folded in as bit 4 —
+/// which is exactly how a terminal encodes a modified click, and how vaxis
+/// decodes one (Parser.zig mouse_bits.ctrl = 0b00010000).
fn buttonCode(name: []const u8) ?u16 {
+ if (std.mem.startsWith(u8, name, "ctrl-")) {
+ const base = buttonCode(name["ctrl-".len..]) orelse return null;
+ return base + 16;
+ }
if (std.mem.eql(u8, name, "left")) return 0;
if (std.mem.eql(u8, name, "middle")) return 1;
if (std.mem.eql(u8, name, "right")) return 2;