diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 13:54:40 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | e8fc2964acdf7156ab0c9961b7bf83d74f152192 (patch) | |
| tree | af05298c50c8ba4237e2200ef2cf4b15e3b3e81e /src/exec.zig | |
| parent | a33fc226c32d97a053bafdb13d6ec3bf8b537f35 (diff) | |
| download | pardes-e8fc2964acdf7156ab0c9961b7bf83d74f152192.tar.gz pardes-e8fc2964acdf7156ab0c9961b7bf83d74f152192.zip | |
DumpConfig's lines that set nothing start with #, and a line starting with # runs as nothing at an exec, a ctl or the init file
DumpConfig's information lines ("Platform: tty", "Startup config: ...")
began with words. Written back, as the report means to be, or clicked,
each ran as a shell command or failed as an unknown control message.
Each now starts with `# `. A line starting with `#` is a comment, as in a
shell: it runs as nothing, silently, at an exec, at the root's, a pane's
or a column's ctl, and in the init file. Documented in fs.md and
config.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/exec.zig')
| -rw-r--r-- | src/exec.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/exec.zig b/src/exec.zig index 6070d038..8356db75 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -643,7 +643,16 @@ pub fn execute(p: *Pardes, id: usize, txt: []const u8) ?usize { /// `execute` for text a gesture took from `id`'s body when `from_body`: /// such text may be a bound REPL's. Run by name (`Exec ...`, whose line /// comes back through `execute`) or written as a command word, never. +/// A line that starts with `#` is a comment, as in a shell: it runs as +/// nothing, silently, wherever a line runs (exec, a ctl, the init file), +/// so DumpConfig's report reads back as configuration whole. +pub fn isComment(line: []const u8) bool { + const t = std.mem.trimStart(u8, line, " \t"); + return t.len > 0 and t[0] == '#'; +} + pub fn executeFrom(p: *Pardes, id: usize, txt: []const u8, from_body: bool) ?usize { + if (isComment(commandText(txt))) return null; // An empty window runs its session words, and a command line in the // session's directory (execDir), as its workspace tag would. const pane = p.panes[id] orelse { @@ -841,6 +850,7 @@ pub const acme_words = [_]struct { acme: []const u8, pardes: ?[]const u8, hint: pub fn executeBuiltinLine(p: *Pardes, id: usize, txt: []const u8) bool { const raw = commandText(txt); if (raw.len == 0 or p.exec_depth >= max_exec_depth) return false; + if (isComment(raw)) return true; const word_end = std.mem.indexOfAny(u8, raw, " \t") orelse raw.len; var renamed: [1024 + 16]u8 = undefined; const cmd = for (acme_words) |w| { |
