summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 14:20:56 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commite7c181d6238dae4b08a02c1a9828917c2497f89d (patch)
tree299d4146c53ca5f882ba37cceb67a37302be2437 /src/ninep/ctl.zig
parenteb2428115588004a8bc04a09d45fb1104f727882 (diff)
downloadpardes-e7c181d6238dae4b08a02c1a9828917c2497f89d.tar.gz
pardes-e7c181d6238dae4b08a02c1a9828917c2497f89d.zip
A command line runs as its own command pane unless it is clicked at a shell's prompt
A middle click, an exec write or a tag word that no builtin knows was typed into some terminal for the pane's directory, sharing whatever state that shell was in and answering nothing, so a misspelling vanished into a shell. Now only a line clicked at an interactive terminal's prompt is typed there. From anywhere else it runs as a command pane: a terminal whose child is $SHELL -c the line in the pane's directory, full emulation, which shows its output and then exit N from the host's reaping of the child, and stays. A finished command pane is the next command's for its directory, which runs below what it showed after a '% line' line (acme appends to +Errors and never clears it, util.c:213); a running one gets a second pane. Kill ends a command pane's whole process group, the log records run and exit, exec reads back the command pane's serial, and a line is at most 1 KB, read off the pane as the host forks rather than carried in every spawn effect. ttyForDir's search for a free shell is gone. The goldens of chordcut, cmdword and layout-open change where a file's exec now opens a command pane, and ttytaken is rewritten to exec from the terminal itself; docs/open-questions.md records the decision. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index c1cfa1f6..deb64565 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -67,7 +67,12 @@ fn run(p: *Pardes, id: usize, exec: bool, text: []const u8) void {
return noteResult(p, context);
}
const before = Serials.snapshot(p);
- if (exec) _ = pardes.exec.execute(p, id, text) else look.lookAt(p, id, text);
+ // An exec answers the pane it went to: a command pane it reused, or
+ // the terminal it typed into.
+ const went: ?usize = if (exec) pardes.exec.execute(p, id, text) else blk: {
+ look.lookAt(p, id, text);
+ break :blk null;
+ };
const after = Serials.snapshot(p);
var created = false;
for (after.list[0..after.len]) |serial| if (std.mem.indexOfScalar(u32, before.list[0..before.len], serial) == null) {
@@ -75,6 +80,7 @@ fn run(p: *Pardes, id: usize, exec: bool, text: []const u8) void {
created = true;
};
if (created) return;
+ if (went) |dst| if (p.panes[dst]) |pane| return noteResult(p, pane.serial);
noteResult(p, if (exec) context else (p.panes[p.active] orelse return).serial);
}