summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
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;