From 429c1e5e65afa4c65fa42bbb117c4b32a46a9470 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 05:14:06 -0300 Subject: 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 --- src/mouse.zig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/mouse.zig') 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 }); } -- cgit v1.3