summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 20:56:14 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit04b047fb366ea2c595708fb62467f690fce4b9ec (patch)
treeb2b765cbca96bcfd1785a39f60f0e0398a6aabb2 /src/exec.zig
parent9554cc4c544632b01f740f895fd6db9f9952c02e (diff)
downloadpardes-04b047fb366ea2c595708fb62467f690fce4b9ec.tar.gz
pardes-04b047fb366ea2c595708fb62467f690fce4b9ec.zip
Terminal.zig is terminal.zig: a file of functions and no fields takes a namespace's lowercase name
The last of the deferred renames, now that the tty and theme agents have landed: panes.terminal at its importers, the alias lines in Text.zig and File.zig and panes.zig's own uses following. dump.zig's Terminal struct, a dump record, is not this. The served sources list and docs/design.typ name the new file. test/perf.zig's references change, so the three perf baselines take its new harness id with their numbers as recorded. No behaviour changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/exec.zig b/src/exec.zig
index 2c42389c..221de105 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -42,11 +42,11 @@ pub fn takesCommandLine(p: *const Pardes, id: usize) bool {
// idle, EMPTY prompt is typed at; otherwise a new pane runs the line.
// (Text in pardes's own edit buffer is not the shell's yet: an exec of
// it, or of anything, types only what it runs.)
- if (panes.Terminal.promptInputReady(pane) and !panes.Terminal.promptInputEmpty(pane)) return false;
+ if (panes.terminal.promptInputReady(pane) and !panes.terminal.promptInputEmpty(pane)) return false;
// A mounted shell sits behind sudo's process supervisor. Its OSC 133
// prompt marks identify input readiness; the launcher's executable is
// not the shell executable used by the ordinary process heuristic.
- if (pane.v9fs_on_spawn) return panes.Terminal.promptInputReady(pane);
+ if (pane.v9fs_on_spawn) return panes.terminal.promptInputReady(pane);
return !p.hostTtyTaken(id);
}
@@ -111,7 +111,7 @@ pub fn pointerOperand(p: *Pardes, pane: *Pane, clicked: Pane.Sel) PointerOperand
const visible = clicked.r0 - @as(i32, pane.tag_rows);
const wrapped = pane.wrapAt(visible);
const raw = pane.isTerminal() and pane.body.mode == .tty and clicked.r0 >= pane.tag_rows;
- const row = if (raw) panes.Terminal.gridOffset(pane) + visible else wrapped.line;
+ const row = if (raw) panes.terminal.gridOffset(pane) + visible else wrapped.line;
const raw_line = if (raw) modal.lineSlice(body_layer.bodyText(p, p.scratch.allocator(), pane) catch "", @intCast(@max(0, visible))) else "";
const col = if (raw)
@as(i32, @intCast(panes.File.rawAtDisplay(raw_line, @intCast(@max(0, clicked.c0)))))
@@ -143,7 +143,7 @@ pub fn pointerOperand(p: *Pardes, pane: *Pane, clicked: Pane.Sel) PointerOperand
lo -|= span.prompt_bytes;
hi -|= span.prompt_bytes;
} else if (!span.raw_terminal and raw) {
- const prefix = panes.Terminal.promptPrefixBytes(pane, row, raw_line);
+ const prefix = panes.terminal.promptPrefixBytes(pane, row, raw_line);
lo += prefix;
hi += prefix;
}
@@ -429,8 +429,8 @@ pub fn evictLonePristineTty(p: *Pardes, col: usize, keep_id: usize) void {
const tt = p.panes[tty_id] orelse return;
// No typing, cursor on the first prompt line, no scrollback: this is
// the throwaway boot placeholder a document may replace.
- if (tt.ovl != null or panes.Terminal.gridCursor(tt).y != 0 or
- panes.Terminal.scrollbar(tt).total > tt.rows) return;
+ if (tt.ovl != null or panes.terminal.gridCursor(tt).y != 0 or
+ panes.terminal.scrollbar(tt).total > tt.rows) return;
p.deinitPane(tt) catch |err| return p.reportError(tty_id, "close", err);
layout.compute(p); // a just-stacked doc has no rect yet; absorb snaps to rows
_ = layout.absorbVWeight(p, tty_id, null);
@@ -588,7 +588,7 @@ pub fn sendToRepl(p: *Pardes, from: usize, to: usize, text: []const u8) void {
var said: [128]u8 = undefined;
return p.setMessage(from, std.fmt.bufPrint(&said, "Repl: {d} bytes is more than can be sent at once; send less", .{n}) catch "Repl: too long to send");
}
- const pasted = panes.Terminal.bracketedPaste(dst);
+ const pasted = panes.terminal.bracketedPaste(dst);
edit.typeToTty(p, to, dst, clean[0..n]);
// A Python block whose last line is indented, or a bare header, is not
// over at one Enter, pasted into 3.13's REPL or typed into the old one:
@@ -611,7 +611,7 @@ pub fn sendToRepl(p: *Pardes, from: usize, to: usize, text: []const u8) void {
dst.repl_enter_due_ns = clockNow(p) + repl_enter_wait_ns;
} else for (0..enters) |_| p.emitWrite(to, "\r");
// Line by line, a blank line inside a Python block ends the block.
- if (!panes.Terminal.bracketedPaste(dst) and !dst.repl_warned and (if (dst.repl) |r| r.lang == python_lang else false) and
+ if (!panes.terminal.bracketedPaste(dst) and !dst.repl_warned and (if (dst.repl) |r| r.lang == python_lang else false) and
std.mem.indexOfScalar(u8, text, '\n') != null)
{
dst.repl_warned = true;
@@ -671,9 +671,9 @@ pub fn executeFrom(p: *Pardes, id: usize, txt: []const u8, from_body: bool) ?usi
return null;
}
if (!takesCommandLine(p, id)) return runCommand(p, id, cmd);
- panes.Terminal.padOutputBelowEdits(p, id);
- panes.Terminal.noteCommand(pane, cmd);
- if (panes.Terminal.queuePendingCommand(pane, cmd) catch |err| {
+ panes.terminal.padOutputBelowEdits(p, id);
+ panes.terminal.noteCommand(pane, cmd);
+ if (panes.terminal.queuePendingCommand(pane, cmd) catch |err| {
p.reportError(id, "queue command", err);
return id;
}) return id;
@@ -733,8 +733,8 @@ fn runCommand(p: *Pardes, from: usize, line: []const u8) ?usize {
// saved cursor), mouse reports and bracketed paste off, the cursor
// shown, colours reset. (Not DECSTR: ghostty's stream does not
// implement it.)
- if (panes.Terminal.onAlternateScreen(pane)) panes.Terminal.feedOutput(p, pane, "\x1b[?1049l");
- panes.Terminal.feedOutput(p, pane, "\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l\x1b[?2004l\x1b[?25h\x1b[0m");
+ if (panes.terminal.onAlternateScreen(pane)) panes.terminal.feedOutput(p, pane, "\x1b[?1049l");
+ panes.terminal.feedOutput(p, pane, "\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l\x1b[?2004l\x1b[?25h\x1b[0m");
echoCommand(p, pane, line);
p.emitSpawn(id, pane.serial, pane.cwdSlice());
noteRun(p, pane, "run", line);
@@ -760,10 +760,10 @@ fn runCommand(p: *Pardes, from: usize, line: []const u8) ?usize {
fn echoCommand(p: *Pardes, pane: *Pane, line: []const u8) void {
var buf: [2 * command_max + 8]u8 = undefined;
var w = std.Io.Writer.fixed(&buf);
- w.writeAll(if (panes.Terminal.gridCursor(pane).x != 0) "\r\n% " else "% ") catch {};
+ w.writeAll(if (panes.terminal.gridCursor(pane).x != 0) "\r\n% " else "% ") catch {};
for (line) |c| (if (c == '\n') w.writeAll("\r\n") else w.writeByte(c)) catch {};
w.writeAll("\r\n") catch {};
- panes.Terminal.feedOutput(p, pane, w.buffered());
+ panes.terminal.feedOutput(p, pane, w.buffered());
}
/// `run <serial> <word>` or `exit <serial> <N|?>` in the log.
@@ -788,8 +788,8 @@ pub fn commandDone(p: *Pardes, id: usize, status: ?u8) void {
var buf: [16]u8 = undefined;
const code = if (status) |n| std.fmt.bufPrint(&buf, "{d}", .{n}) catch "?" else "?";
var said: [32]u8 = undefined;
- const lead = if (panes.Terminal.gridCursor(pane).x != 0) "\r\n" else "";
- panes.Terminal.feedOutput(p, pane, std.fmt.bufPrint(&said, "{s}exit {s}\r\n", .{ lead, code }) catch "exit ?\r\n");
+ const lead = if (panes.terminal.gridCursor(pane).x != 0) "\r\n" else "";
+ panes.terminal.feedOutput(p, pane, std.fmt.bufPrint(&said, "{s}exit {s}\r\n", .{ lead, code }) catch "exit ?\r\n");
noteRun(p, pane, "exit", code);
p.needs_frame = true;
}