summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 14:20:12 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit25c847e28ae77f5c648d423d64011736f55eda4a (patch)
tree38a2e3694a1c4db8ee0f6acebb420109e00d020a /src/ninep
parentb7d3c0c1d9b2ba4e5181e56f15015dd9c996c5a8 (diff)
downloadpardes-25c847e28ae77f5c648d423d64011736f55eda4a.tar.gz
pardes-25c847e28ae77f5c648d423d64011736f55eda4a.zip
Delcol on the last column leaves the window, empty but for its workspace tag, as acme's does
The last column's Delcol ended the session. The window now stays, with only the workspace tag; Newcol, and New (which makes the column it goes in), start it again. A word run with no pane at all runs with a stand-in that is no pane, the root ctl takes session words, and pane/new makes its scratch in the session's directory. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/ctl.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 256b94ad..98899edb 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -52,7 +52,7 @@ fn noteResult(p: *Pardes, serial: u32) void {
/// created; failing that, a look records the pane it focused and an exec
/// the pane it acted on (even one it closed).
pub fn run(p: *Pardes, id: usize, exec: bool, text: []const u8, in_tag: bool) void {
- const context = p.panes[id].?.serial;
+ const context = if (p.panes[id]) |pane| pane.serial else 0;
// A pane an event reader holds hears its clicks instead of acting on
// them (editors/acme/look.c:53 and exec.c:173 send them to winevent),
// and a line written to a look or exec is a click: on that pane, or for
@@ -446,7 +446,7 @@ pub fn runBuiltin(p: *Pardes, req: Req, id: usize, line: []const u8) ?Reply {
defer p.fs.no_prompt = false;
// What a ctl write touched reads back from /look and /exec as a click's
// does (`run`), so a script that made a pane with `Tty` finds it there.
- const context = p.panes[id].?.serial;
+ const context = if (p.panes[id]) |pane| pane.serial else 0;
const before = Serials.snapshot(p);
_ = exec_line.executeBuiltinLine(p, id, line);
const after = Serials.snapshot(p);
@@ -580,7 +580,8 @@ pub fn writeRoot(p: *Pardes, req: Req) Reply {
if (checkBuiltin(p, req, line, .session)) |refusal| return refusal;
continue;
}
- if (p.panes[p.active] == null) return Reply.fail(req.tag, E.NOENT);
+ // An empty window (no pane at all) still takes its session words.
+ if (p.panes[p.active] == null and p.anyPane() != null) return Reply.fail(req.tag, E.NOENT);
p.fs.session_write = true;
defer p.fs.session_write = false;
if (runBuiltin(p, req, p.active, line)) |refusal| return refusal;