summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tty.zig5
-rw-r--r--test/snapshots/ghostty-mid.golden31
-rw-r--r--test/snapshots/ghostty-mid.snap32
3 files changed, 68 insertions, 0 deletions
diff --git a/src/tty.zig b/src/tty.zig
index d9821343..4cb4fa1d 100644
--- a/src/tty.zig
+++ b/src/tty.zig
@@ -44,6 +44,11 @@ pub fn run(init: std.process.Init, opts: pardes.Options) !void {
defer vx.deinit(gpa, tty.writer());
try vx.enterAltScreen(tty.writer());
defer vx.exitAltScreen(tty.writer()) catch {};
+ // requests 1002;1003;1004;1006 (cell-coordinate SGR; called pre-query, so
+ // vaxis never upgrades to 1016 pixel mode). Note: ghostty's GTK apprt drops
+ // middle press+release BEFORE mouse reporting when the desktop sets
+ // gtk-enable-primary-paste=false — no mode we request can surface middle
+ // clicks there (see test/snapshots/ghostty-mid.snap).
try vx.setMouseMode(tty.writer(), true);
var frame_arena: std.heap.ArenaAllocator = .init(gpa);
diff --git a/test/snapshots/ghostty-mid.golden b/test/snapshots/ghostty-mid.golden
new file mode 100644
index 00000000..597d2061
--- /dev/null
+++ b/test/snapshots/ghostty-mid.golden
@@ -0,0 +1,31 @@
+== snap ghostty-mid grid=100x30 cursor=4,7
+|Kill Newcol Tutor Debug Colors NextColor Dump
+| nm /tmp/pardes-snap/ghostty-mid/cwd Del nm /tmp/pardes-snap/ghostty-mid/cwd Del
+| ZZPAD
+| ./g.sh g.txt
+|
+| GHOSTOK
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+| nm /tmp/pardes-snap/ghostty-mid/cwd Del
+|
+| g.txt
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
diff --git a/test/snapshots/ghostty-mid.snap b/test/snapshots/ghostty-mid.snap
new file mode 100644
index 00000000..437fce27
--- /dev/null
+++ b/test/snapshots/ghostty-mid.snap
@@ -0,0 +1,32 @@
+# ghostty's wire flavor of a middle click, byte-exact (mode 1002;1003;1004;1006
+# as pardes requests): focus-in, per-cell hover motions (ghostty dedups per
+# cell, so none repeat), press keeping SGR button identity, release 'm',
+# trailing hover — split across writes like real input. Proves the tty input
+# path (vaxis parse -> core execute) handles ghostty's encoding: the live bug
+# ("middle click dead only in ghostty") is ghostty's GTK apprt swallowing
+# middle press+release BEFORE mouse reporting whenever the desktop has
+# gtk-enable-primary-paste=false (apprt/gtk/class/surface.zig, gcMouseDown/
+# gcMouseUp) — the bytes below simply never get sent.
+file g.txt x
+start 30 100
+wait 8000 g.txt
+stable 700 20000
+press left 5 8
+release left 5 8
+stable 400 5000
+key c-b
+stable 600 8000
+text printf '#!/bin/sh\necho GHOST''OK\n' > g.sh; chmod +x g.sh; clear; printf 'ZZPAD\n./g.sh\n'
+key enter
+wait 10000 ./g.sh
+stable 700 10000
+key c-b
+stable 600 8000
+send \x1b[I
+send \x1b[<35;10;8M\x1b[<35;7;6M\x1b[<35;4;4M
+send \x1b[<1;4;4M
+send \x1b[<1;4;4m
+send \x1b[<35;6;4M
+wait 10000 GHOSTOK
+stable 700 10000
+snap ghostty-mid