diff options
Diffstat (limited to 'src/exec.zig')
| -rw-r--r-- | src/exec.zig | 9 |
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; |
