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/exec.zig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/exec.zig') diff --git a/src/exec.zig b/src/exec.zig index aee2e1e5..2b0c90cb 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -733,6 +733,15 @@ pub fn commandText(txt: []const u8) []const u8 { return cmd; } +/// The builtin a command line's first word names, as acme's lookup reads +/// only the first word (editors/acme/exec.c, lookup): what an event's +/// flag 1 says. +pub fn namesBuiltin(txt: []const u8) bool { + const cmd = commandText(txt); + const end = std.mem.indexOfAny(u8, cmd, " \t") orelse cmd.len; + return std.meta.stringToEnum(Builtin, cmd[0..end]) != null; +} + pub fn executeBuiltinLine(p: *Pardes, id: usize, txt: []const u8) bool { const cmd = commandText(txt); if (cmd.len == 0 or p.exec_depth >= max_exec_depth) return false; -- cgit v1.3