From 97780909cbe0f4c62dfb9b012bff3fe7e7ec32f9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 07:21:10 -0300 Subject: An event record never carries flag 2, as no expansion record follows; flag 1 reads the first word In acme flag 2 promises a second record with the expanded range, and acme's libraries read one. F records set it always and a click with no range known set it, with none following: a library then took the next event for it. Records here carry the word already, so 2 is never set. Flag 1 now reads the first word as acme's lookup does, so `Msg hi` is 1. Co-Authored-By: Claude Opus 5.5 --- src/mouse.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mouse.zig') diff --git a/src/mouse.zig b/src/mouse.zig index 9eefa9a1..5bfd92ee 100644 --- a/src/mouse.zig +++ b/src/mouse.zig @@ -723,10 +723,12 @@ fn reportGesture( (if (on_tag) .tag_look else .body_look) else (if (on_tag) .tag_exec else .body_exec); - const named = std.meta.stringToEnum(Builtin, exec.commandText(text)) != null; + const named = exec.namesBuiltin(text); const range = gestureRange(p, id, text, on_tag, operand); + // No flag 2: the record already carries the word a click took, its + // range and text, and in acme flag 2 promises a second record with them + // (editors/acme/exec.c:154-183, look.c:42-68), which none follows here. var flag: u32 = if (named) ctlfs.events.flag_builtin else 0; - if (range.q0 == range.q1 and text.len > 0) flag |= ctlfs.events.flag_expansion; if (is_look) { if (!named and std.mem.indexOfAny(u8, text, "/.:") != null) flag |= ctlfs.events.flag_filename; } else if (chord_arg != null) flag |= ctlfs.events.flag_chorded; @@ -1670,7 +1672,7 @@ test "a chorded exec an event reader holds is told with its argument, and writte @memcpy(g[0..bytes.len], bytes); r.* = g[0..bytes.len]; } - try std.testing.expect(std.mem.endsWith(u8, records[0], " 11 3 Msg\n")); // builtin|expansion|chorded + try std.testing.expect(std.mem.endsWith(u8, records[0], " 9 3 Msg\n")); // builtin|chorded, no expansion record try std.testing.expectEqualStrings("X0 0 0 8 arg-text\n", records[1][1..]); try std.testing.expect(std.mem.endsWith(u8, records[2], "test.txt:#9,#17\n")); // Written back whole, it runs with its argument. -- cgit v1.3