summaryrefslogtreecommitdiff
path: root/src/ninep/pty.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/ninep/pty.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/ninep/pty.zig')
-rw-r--r--src/ninep/pty.zig24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig
index 8ba9f4df..0f5202cc 100644
--- a/src/ninep/pty.zig
+++ b/src/ninep/pty.zig
@@ -139,9 +139,9 @@ pub fn readStatus(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply {
// or a line is typed at the prompt. Before the shell's first prompt a
// run waits for it rather than answer busy, so that is not busy.
// A build with no terminal panes (the board) has no marks to read.
- const marks = if (comptime !pardes.panes.Terminal.enabled) null else if (pane.terminal) |state| &state.stream.handler else null;
+ const marks = if (comptime !pardes.panes.terminal.enabled) null else if (pane.terminal) |state| &state.stream.handler else null;
const busy = p.hostTtyTaken(id) or (!pane.fs.unmarked and (waitingRun(p, pane) != null or
- (if (marks) |m| m.prompts > 0 and (m.phase != .input or !pardes.panes.Terminal.promptInputEmpty(pane)) else false)));
+ (if (marks) |m| m.prompts > 0 and (m.phase != .input or !pardes.panes.terminal.promptInputEmpty(pane)) else false)));
const out = p.fs.stage(p.gpa);
const size = winsize(pane);
out.print(p.gpa, "{d:>11} {d:>11} {d:>11}\n", .{ size[0], size[1], @intFromBool(busy) }) catch {};
@@ -222,7 +222,7 @@ pub fn writeRun(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply {
if (std.mem.trim(u8, line, " \t").len == 0) return tree.failText(req.tag, E.INVAL, e_bad_line);
if (line.len == 0) return tree.failText(req.tag, E.INVAL, e_bad_line);
for (line) |c| if (c < ' ' and c != '\t') return tree.failText(req.tag, E.INVAL, e_bad_line);
- if (comptime !pardes.panes.Terminal.enabled) return tree.failText(req.tag, E.INVAL, e_bad_line);
+ if (comptime !pardes.panes.terminal.enabled) return tree.failText(req.tag, E.INVAL, e_bad_line);
const pf = &pane.fs;
const state = pane.terminal orelse return tree.failText(req.tag, E.INVAL, e_bad_line);
const marks = &state.stream.handler;
@@ -235,7 +235,7 @@ pub fn writeRun(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply {
} else if (pf.unmarked) {
answer(p, slot, "error no prompt marks", .{});
} else if (waitingRun(p, pane) != null or (marks.prompts > 0 and (marks.phase != .input or
- !pardes.panes.Terminal.promptInputEmpty(pane) or p.hostTtyTaken(id))))
+ !pardes.panes.terminal.promptInputEmpty(pane) or p.hostTtyTaken(id))))
{
// Something is running or someone has typed at the prompt: sending
// now would type into the middle of it. The phase is pardes's own
@@ -288,7 +288,7 @@ pub fn readRun(p: *Pardes, req: Req) Reply {
/// for the prompt means whoever reads the answer can send the next command
/// at once instead of finding the shell still drawing it.
pub fn noteMarks(p: *Pardes, id: usize, pane: *Pane) void {
- if (comptime !pardes.panes.Terminal.enabled) return;
+ if (comptime !pardes.panes.terminal.enabled) return;
const state = pane.terminal orelse return;
const pf = &pane.fs;
const slot = waitingRun(p, pane) orelse return;
@@ -299,13 +299,13 @@ pub fn noteMarks(p: *Pardes, id: usize, pane: *Pane) void {
pf.run = null;
return;
}
- if (marks.phase != .input or !pardes.panes.Terminal.promptInputEmpty(pane) or p.hostTtyTaken(id)) return;
+ if (marks.phase != .input or !pardes.panes.terminal.promptInputEmpty(pane) or p.hostTtyTaken(id)) return;
slot.want = marks.started +% 1;
slot.prompts = marks.prompts;
slot.declined = marks.declined;
p.emitWrite(id, slot.line);
p.emitWrite(id, "\r");
- pardes.panes.Terminal.noteCommand(pane, slot.line);
+ pardes.panes.terminal.noteCommand(pane, slot.line);
slot.phase = .sent;
return;
}
@@ -319,7 +319,7 @@ pub fn noteMarks(p: *Pardes, id: usize, pane: *Pane) void {
// typed into an empty prompt, so throw it away with Ctrl-C, which
// drops the whole pending command, and answer at the prompt after
// that, so the next line finds the shell clear.
- const empty = pardes.panes.Terminal.promptInputEmpty(pane);
+ const empty = pardes.panes.terminal.promptInputEmpty(pane);
switch (slot.cleared) {
.no => {
if (marks.continuation) {
@@ -360,7 +360,7 @@ pub fn noteMarks(p: *Pardes, id: usize, pane: *Pane) void {
/// Answers a run whose command ended with `status`: the header and the
/// output it printed.
fn finish(p: *Pardes, slot: *Run, pane: *Pane, status_code: ?i32) void {
- const printed = pardes.panes.Terminal.commandOutput(pane, p.gpa, output_rows) catch
+ const printed = pardes.panes.terminal.commandOutput(pane, p.gpa, output_rows) catch
return answer(p, slot, "error out of memory", .{});
defer p.gpa.free(printed.text);
// Keep the tail, cut at a line start so the first line kept is whole.
@@ -400,7 +400,7 @@ pub fn shellExited(p: *Pardes, pane: *Pane, status: ?u8) void {
const code = status orelse return;
if (waitingRun(p, pane)) |slot| if (slot.phase == .sent) {
pane.fs.run = null;
- pardes.panes.Terminal.endOutputHere(pane);
+ pardes.panes.terminal.endOutputHere(pane);
finish(p, slot, pane, code);
};
var buf: [4]u8 = undefined;
@@ -963,10 +963,10 @@ test "a run's answer says cut when its output's start is gone, and reads a bound
// A resize between its start and end reflows the pins with the text.
h = sh.send(p, node);
sh.put(p, c ++ "one\r\ntwo\r\n");
- pardes.panes.Terminal.resizeGrid(pane, gpa, 50, 20);
+ pardes.panes.terminal.resizeGrid(pane, gpa, 50, 20);
sh.put(p, d ++ prompt);
try testing.expectEqualStrings("exit 0\none\ntwo\n", sh.answered(p, node, h, into));
- pardes.panes.Terminal.resizeGrid(pane, gpa, pane.cols, pane.rows);
+ pardes.panes.terminal.resizeGrid(pane, gpa, pane.cols, pane.rows);
// A full-screen program leaves nothing on the primary screen, and a D
// with no status is not a success.