summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 07:21:10 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit97780909cbe0f4c62dfb9b012bff3fe7e7ec32f9 (patch)
tree35eef2c6ceca2dd6e3cf8047d66d6134c929245d /src/exec.zig
parenta0bca6764a6a425b71e1567ff9d49f9828c5813c (diff)
downloadpardes-97780909cbe0f4c62dfb9b012bff3fe7e7ec32f9.tar.gz
pardes-97780909cbe0f4c62dfb9b012bff3fe7e7ec32f9.zip
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 <[email protected]>
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig9
1 files changed, 9 insertions, 0 deletions
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;