summaryrefslogtreecommitdiff
path: root/src/exec.zig
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/exec.zig
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/exec.zig')
-rw-r--r--src/exec.zig14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/exec.zig b/src/exec.zig
index 4785e7a2..06e5d375 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -643,7 +643,12 @@ pub fn execute(p: *Pardes, id: usize, txt: []const u8) ?usize {
/// 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.
pub fn executeFrom(p: *Pardes, id: usize, txt: []const u8, from_body: bool) ?usize {
- const pane = p.panes[id] orelse return null;
+ // An empty window runs its session words, and nothing else: no pane to
+ // run a command for.
+ const pane = p.panes[id] orelse {
+ _ = executeBuiltinLine(p, id, commandText(txt));
+ return null;
+ };
const gesture = from_body and config.commandWord(std.mem.trim(u8, txt, " \t\r\n")) == null;
const cmd = commandText(txt);
if (cmd.len == 0) return null;
@@ -891,7 +896,9 @@ pub fn runBuiltin(p: *Pardes, b: Builtin, id: usize, txt: []const u8, arg: ?[]co
/// `runBuiltin` saying whether a gesture on the pane's body made it.
pub fn runBuiltinFrom(p: *Pardes, b: Builtin, id: usize, txt: []const u8, arg: ?[]const u8, from_body: bool) void {
if (!normal.multiOnce(p)) return; // a builtin is per-keystroke, never per-cursor
- const pane = p.panes[id] orelse return;
+ // No pane at all (the window Delcol emptied): a word runs all the same,
+ // with a stand-in that is no pane (New, Newcol, Exit are what make sense).
+ const pane = p.panes[id] orelse (if (builtins.registry.scope(b) == .session or p.anyPane() == null) p.standIn() orelse return else return);
// A builtin says its own name before it runs, so a tagline click is
// legible even when what it did is invisible. Whatever the builtin
// then says for itself replaces the announcement. It is the message
@@ -1000,6 +1007,9 @@ pub const NewPane = enum { scratch, fs, shell, doc, command, errors };
/// from: null when a column tag, the workspace tag or 9P asked (acme's
/// t->w == nil).
pub fn placeNew(p: *Pardes, from: usize, origin: ?usize, id: usize, kind: NewPane) void {
+ // No column left (the last one Delcol'd): a pane made from the workspace
+ // tag opens one to go in.
+ _ = layout.firstColumn(p);
const asked = if (p.exec_column != null) null else origin;
layout.compute(p);
const before = p.rects;