summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig38
1 files changed, 2 insertions, 36 deletions
diff --git a/src/exec.zig b/src/exec.zig
index d0bee0e9..96902889 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -771,7 +771,7 @@ fn runCommand(p: *Pardes, from: usize, line: []const u8) ?usize {
echoCommand(p, pane, line);
pane.command_from = winid(p, src);
p.emitSpawn(id, pane.serial, pane.cwdSlice());
- noteRun(p, pane, "run", line);
+ pane.noteRun(p, "run", line);
return id;
}
const free = p.freeSlot() orelse {
@@ -789,7 +789,7 @@ fn runCommand(p: *Pardes, from: usize, line: []const u8) ?usize {
p.reportError(from, "exec", error.NoPaneRoom);
return null;
}
- noteRun(p, pane, "run", line);
+ pane.noteRun(p, "run", line);
return free;
}
@@ -824,40 +824,6 @@ fn echoCommand(p: *Pardes, pane: *Pane, line: []const u8) void {
panes.terminal.feedOutput(p, pane, w.buffered());
}
-/// `run <serial> <word>` or `exit <serial> <N|?>` in the log.
-/// The whole line, one record as `msg` carries its text: its control
-/// characters, a newline too, become spaces (events.pushLog). A new pane is
-/// announced first, so `new` comes before the `run` in it.
-pub fn noteRun(p: *Pardes, pane: *Pane, what: []const u8, said: []const u8) void {
- pardes.ctlfs.events.announce(p);
- var buf: pardes.Kind.Buf(command_max + 16) = .{};
- pardes.ctlfs.events.notePath(p, what, buf.print("{d} {s}", .{ pane.serial, std.mem.trim(u8, said, " \t\r\n") }));
-}
-
-/// A command pane's child is gone: the pane stays, showing what it said
-/// and how it ended, and is the next command's for its directory.
-pub fn commandDone(p: *Pardes, id: usize, status: ?u8) void {
- const pane = p.panes[id] orelse return;
- pane.command_done = true;
- // A REPL it was is gone with its command; the pane's next is not one.
- pane.repl = null;
- pane.command_status = status;
- pane.body.mode = .normal;
- // Look's `git show`: its output went to a +Pager, the +Diff now; only a
- // failure is worth the pane.
- if (pane.command_pages) {
- pane.command_pages = false;
- if (status == 0) return p.removePane(id, null) catch |err| p.reportError(id, "close", err);
- }
- var buf: [16]u8 = undefined;
- const code = if (status) |n| std.fmt.bufPrint(&buf, "{d}", .{n}) catch unreachable else "?"; // an exit status fits 16
- var said: pardes.Kind.Buf(32) = .{};
- const lead = if (panes.terminal.gridCursor(pane).x != 0) "\r\n" else "";
- panes.terminal.feedOutput(p, pane, said.print("{s}exit {s}\r\n", .{ lead, code }));
- noteRun(p, pane, "exit", code);
- p.needs_frame = true;
-}
-
/// Trim and unwrap clickable command-word notation once for every command
/// consumer, so startup lines and interactive Exec speak the same syntax.
pub fn commandText(txt: []const u8) []const u8 {