summaryrefslogtreecommitdiff
path: root/src/mouse.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 05:14:06 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit429c1e5e65afa4c65fa42bbb117c4b32a46a9470 (patch)
tree3621a08103b25ea6cbe44d100d09c51adb639256 /src/mouse.zig
parente933535c9c78695dbcc469fff6a966601fd6c8f6 (diff)
downloadpardes-429c1e5e65afa4c65fa42bbb117c4b32a46a9470.tar.gz
pardes-429c1e5e65afa4c65fa42bbb117c4b32a46a9470.zip
A chorded record written back with its two follow-ups runs once, with its argument
Writing a chorded exec's three records back as read ran the argument and its location as shell commands. The first record (flag 8) now takes the next record as its argument when it comes in the same write, else the one kept from the click (or, with none kept, waits for it); its two follow-up records, however they are written, are consumed as its, never run. Tested written back together and one per write. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/mouse.zig')
-rw-r--r--src/mouse.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mouse.zig b/src/mouse.zig
index 9f054e2e..0d1bfadd 100644
--- a/src/mouse.zig
+++ b/src/mouse.zig
@@ -1676,5 +1676,22 @@ test "a chorded exec an event reader holds is told with its argument, and writte
try std.testing.expectEqual(ctlfs.Status.ok, th.call(p, .{ .tag = 3, .op = .write, .node = event, .handle = h, .data = line }).reply.status);
const pane = p.panes[0].?;
try std.testing.expectEqualStrings("arg-text", pane.msg[0..pane.msg_len]);
+ // All three records written back as read, in one write or in three:
+ // the two after the first are its argument and where it came from,
+ // never commands of their own.
+ for ([_]bool{ true, false }) |together| {
+ pane.msg_len = 0;
+ var all: [256]u8 = undefined;
+ var w = std.Io.Writer.fixed(&all);
+ for (records) |r| try w.print("M{s}", .{r[1..]});
+ if (together) {
+ _ = th.call(p, .{ .tag = 5, .op = .write, .node = event, .handle = h, .data = w.buffered() });
+ } else for (records) |r| {
+ var one: [80]u8 = undefined;
+ _ = th.call(p, .{ .tag = 6, .op = .write, .node = event, .handle = h, .data = try std.fmt.bufPrint(&one, "M{s}", .{r[1..]}) });
+ }
+ try std.testing.expectEqualStrings("arg-text", pane.msg[0..pane.msg_len]);
+ try std.testing.expect(!th.logHas(p, "run "));
+ }
_ = th.call(p, .{ .tag = 4, .op = .release, .node = event, .handle = h });
}