summaryrefslogtreecommitdiff
path: root/core/Core.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Core.zig')
-rw-r--r--core/Core.zig142
1 files changed, 71 insertions, 71 deletions
diff --git a/core/Core.zig b/core/Core.zig
index 85087b11..e3238a6e 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -883,7 +883,7 @@ pub fn deinit(p: *Pardes) void {
/// last pane's Del, the host's own end (its terminal hung up, its window
/// closed). A dump that fails is said as Exit's, in the log.
pub fn endSession(p: *Pardes) void {
- pardes.dump.dumpExit(p) catch |err| p.reportError(p.view().active, "Exit", err);
+ pardes.dump.dumpExit(p) catch |err| p.reportError(.at(p.view().active), "Exit", err);
p.quit = true;
}
@@ -900,7 +900,7 @@ fn setLastDumpInner(p: *Pardes, path: []const u8) void {
/// text) has the old path swapped, never left pointing at a dump that is
/// not the last.
pub fn pointRestoreAt(p: *Pardes, path: []const u8) void {
- const copy = p.gpa.dupe(u8, path) catch |err| return p.reportError(p.view().active, "Restore", err);
+ const copy = p.gpa.dupe(u8, path) catch |err| return p.reportError(.at(p.view().active), "Restore", err);
if (p.last_dump) |old| {
if (p.global_tag.own) |own| swap: {
const a = p.scratch.allocator();
@@ -974,19 +974,19 @@ pub fn writeRoom(p: *const Pardes, id: usize) usize {
pub fn parkPendingWrite(p: *Pardes, id: usize, bytes: []const u8) void {
if (p.pending_write_bytes + bytes.len > limits.pending_write_cap) {
var said: [128]u8 = undefined;
- return p.setMessage(id, std.fmt.bufPrint(&said, "write: {d} bytes for the program dropped, past the {d} MiB that may wait for it", .{ bytes.len, limits.pending_write_cap >> 20 }) catch unreachable); // two numbers fit 128
+ return p.setMessage(.at(id), std.fmt.bufPrint(&said, "write: {d} bytes for the program dropped, past the {d} MiB that may wait for it", .{ bytes.len, limits.pending_write_cap >> 20 }) catch unreachable); // two numbers fit 128
}
if (p.pending_write[id]) |*pw| {
// Compact what the drain already sent before growing: a burst that
// arrives in pieces must not keep re-copying bytes nobody wants.
const keep = pw.bytes.len - pw.off;
- const grown = p.gpa.alloc(u8, keep + bytes.len) catch |err| return p.reportError(id, "write", err);
+ const grown = p.gpa.alloc(u8, keep + bytes.len) catch |err| return p.reportError(.at(id), "write", err);
@memcpy(grown[0..keep], pw.bytes[pw.off..]);
@memcpy(grown[keep..], bytes);
p.gpa.free(pw.bytes);
pw.* = .{ .bytes = grown };
} else {
- p.pending_write[id] = .{ .bytes = p.gpa.dupe(u8, bytes) catch |err| return p.reportError(id, "write", err) };
+ p.pending_write[id] = .{ .bytes = p.gpa.dupe(u8, bytes) catch |err| return p.reportError(.at(id), "write", err) };
}
p.pending_write_bytes += bytes.len;
}
@@ -994,8 +994,8 @@ pub fn parkPendingWrite(p: *Pardes, id: usize, bytes: []const u8) void {
/// The shell reports the spawned pane's working directory (and later cwd
/// changes it observes, e.g. via /proc/<pid>/cwd before each frame).
pub const setCwd = pardes.tape.taped(setCwdInner);
-fn setCwdInner(p: *Pardes, id: usize, cwd: []const u8) void {
- const pane = p.panes[id] orelse return;
+fn setCwdInner(p: *Pardes, id: Pane.Id, cwd: []const u8) void {
+ const pane = p.panes[id.index()] orelse return;
// A command pane stays the directory's it was run for (newCommand).
if (pane.command != null) return;
const cur = switch (pane.cwd) {
@@ -1012,7 +1012,7 @@ fn setCwdInner(p: *Pardes, id: usize, cwd: []const u8) void {
// shell saying it is there is no new name.
const same_name = cur.len == 0 and std.mem.eql(u8, cwd, p.sessionDir());
pane.setOwnedCwd(cwd) catch |err| return p.reportError(id, "directory", err);
- if (look.lookHoverPane(p) == id) look.cancelLookHover(p);
+ if (look.lookHoverPane(p) == id.index()) look.cancelLookHover(p);
// A terminal is named by its directory, so /log hears it renamed; one
// not announced yet is announced under the new name.
if (pane.isTerminal() and !same_name) ctlfs.events.noteLog(p, .rename, pane);
@@ -1029,7 +1029,7 @@ pub fn shellBin(p: *const Pardes) []const u8 {
/// or null with no room. An input, as every host write into the core
/// is: a replica of the session makes the same pane.
pub const adoptShell = pardes.tape.taped(adoptShellInner);
-fn adoptShellInner(p: *Pardes) ?u8 {
+fn adoptShellInner(p: *Pardes) ?Pane.Id {
var newest: u32 = 0;
for (p.panes) |slot| if (slot) |pn| {
newest = @max(newest, pn.serial);
@@ -1037,7 +1037,7 @@ fn adoptShellInner(p: *Pardes) ?u8 {
_ = p.executeBuiltinLine(p.view().active, "Term");
for (p.panes, 0..) |slot, id| if (slot) |pn| if (pn.serial > newest and pn.isTerminal()) {
pn.greet = false;
- return @intCast(id);
+ return .at(id);
};
return null;
}
@@ -1045,15 +1045,15 @@ fn adoptShellInner(p: *Pardes) ?u8 {
/// A terminal's reader failed (no end of file: the host closed its pty):
/// its pane takes keys again, and why is said.
pub const readerFailed = pardes.tape.taped(readerFailedInner);
-fn readerFailedInner(p: *Pardes, id: u8, err: anyerror) void {
- const pane = p.panes[id] orelse return;
+fn readerFailedInner(p: *Pardes, id: Pane.Id, err: anyerror) void {
+ const pane = p.panes[id.index()] orelse return;
pane.body.mode = .normal;
p.reportError(id, "terminal reader", err);
}
pub const acknowledgeShell = pardes.tape.taped(acknowledgeShellInner);
-fn acknowledgeShellInner(p: *Pardes, id: usize, executable: []const u8, prompt_marks: bool) void {
- if (id < MAX_PANES) if (p.panes[id]) |pane| {
+fn acknowledgeShellInner(p: *Pardes, id: Pane.Id, executable: []const u8, prompt_marks: bool) void {
+ if (id.index() < MAX_PANES) if (p.panes[id.index()]) |pane| {
ctlfs.pty.shellGone(p, pane, true); // a respawn replaced whatever ran
pane.shell_failed = false;
pane.had_shell = true;
@@ -1072,12 +1072,12 @@ fn acknowledgeShellInner(p: *Pardes, id: usize, executable: []const u8, prompt_m
};
// The lines queued for it go when it can take them: at its first
// prompt, or now when it draws no marks to wait for.
- if (id < MAX_PANES) if (p.panes[id]) |pane| if (pane.isTerminal() and pane.pending_command.wait == .spawn) {
+ if (id.index() < MAX_PANES) if (p.panes[id.index()]) |pane| if (pane.isTerminal() and pane.pending_command.wait == .spawn) {
if (prompt_marks) {
pane.pending_command.wait = .input;
} else {
pane.greet = false;
- pane.releasePendingCommand(p, id, true);
+ pane.releasePendingCommand(p, id.index(), true);
}
};
if (p.settings.shell.effective.set(executable))
@@ -1161,7 +1161,7 @@ pub inline fn view(p: anytype) if (@typeInfo(@TypeOf(p)).pointer.attrs.@"const")
/// `pardes --attach`ed), as the live one is laid out; null at
/// Views.max. Not live until `toView`.
pub const openView = pardes.tape.taped(openViewInner);
-fn openViewInner(p: *Pardes) ?u8 {
+fn openViewInner(p: *Pardes) ?View.Id {
// Every view taken: one kept for a client that has not come back
// for it (Views.away) goes first. ponytail: no timer lets one go;
// until its place is wanted it costs a parked slot, and a terminal
@@ -1176,14 +1176,14 @@ fn openViewInner(p: *Pardes) ?u8 {
// loaded from a dump has no queue (Replica.initDump).
p.settle();
p.needs_frame = true;
- return Views.open(p);
+ return .at(Views.open(p) orelse return null);
}
/// The client of view `k` gone: its view goes, the others stay. The
/// last one stays the session's own.
pub const closeView = pardes.tape.taped(closeViewInner);
-fn closeViewInner(p: *Pardes, k: u8) void {
- Views.close(p, k);
+fn closeViewInner(p: *Pardes, k: View.Id) void {
+ Views.close(p, k.index());
p.sync();
// What its sync queued (a terminal it sized, sized again) done here,
// in its own unit on every side: the session's next pump is another
@@ -1196,8 +1196,8 @@ fn closeViewInner(p: *Pardes, k: u8) void {
/// goes, and the session's own is laid out as it was (Views.closeKeeping),
/// which the client's rejoin copies. Settled as `closeView` is.
pub const leaveView = pardes.tape.taped(leaveViewInner);
-fn leaveViewInner(p: *Pardes, k: u8) void {
- Views.closeKeeping(p, k);
+fn leaveViewInner(p: *Pardes, k: View.Id) void {
+ Views.closeKeeping(p, k.index());
p.sync();
p.settle();
}
@@ -1205,29 +1205,29 @@ fn leaveViewInner(p: *Pardes, k: u8) void {
/// The client of view `k` gone, to join again for it (an Upgrade's
/// rejoin, a divergence's): its view kept as it is (Views.away).
pub const awayView = pardes.tape.taped(awayViewInner);
-fn awayViewInner(p: *Pardes, k: u8) void {
- Views.away(p, k);
+fn awayViewInner(p: *Pardes, k: View.Id) void {
+ Views.away(p, k.index());
}
/// A client back for view `k`, kept for it (`awayView`): its own again,
/// as it left it; false when it was let go meanwhile. Settled as
/// `openView` is, for the join's dump next.
pub const rejoinView = pardes.tape.taped(rejoinViewInner);
-fn rejoinViewInner(p: *Pardes, k: u8) bool {
- if (!Views.isAway(p, k)) return false;
- p.views_away &= ~(@as(u8, 1) << @intCast(k));
+fn rejoinViewInner(p: *Pardes, k: View.Id) bool {
+ if (!Views.isAway(p, k.index())) return false;
+ p.views_away &= ~(@as(u8, 1) << @intCast(k.index()));
p.settle();
p.needs_frame = true;
return true;
}
/// Into view `k`, before the input its client sent.
-pub fn toView(p: *Pardes, k: u8) void {
+pub fn toView(p: *Pardes, k: View.Id) void {
// By hand, not `taped`: the live view asked again records nothing (a frontend asks before every input).
- if (k == p.live) return;
+ if (k.index() == p.live) return;
const taped = pardes.tape.enter(p, .{ .to_view = k });
defer pardes.tape.leave(p, taped);
- Views.to(p, k);
+ Views.to(p, k.index());
}
/// Something changed the core without going through `update` -- a watched
@@ -1239,10 +1239,10 @@ fn invalidateInner(p: *Pardes) void {
}
pub const reloadWatchedFile = pardes.tape.taped(reloadWatchedFileInner);
-fn reloadWatchedFileInner(p: *Pardes, id: u8, bytes: []const u8) bool {
+fn reloadWatchedFileInner(p: *Pardes, id: Pane.Id, bytes: []const u8) bool {
p.invalidate();
- look.invalidateLookHover(p, id);
- const applied = p.applyWatchedFileChanged(id, bytes);
+ look.invalidateLookHover(p, id.index());
+ const applied = p.applyWatchedFileChanged(id.index(), bytes);
_ = p.scratch.reset(.{ .retain_with_limit = memory.limits.scratch_kept });
p.sync();
return applied;
@@ -1341,31 +1341,31 @@ pub fn hostKillJob(p: *const Pardes, id: usize) bool {
/// on it, or written to it from now on, hears `error shell gone`
/// rather than wait for a prompt that never comes.
pub const shellFailed = pardes.tape.taped(shellFailedInner);
-fn shellFailedInner(p: *Pardes, id: u8, err: anyerror) void {
- const pane = p.panes[id] orelse return;
+fn shellFailedInner(p: *Pardes, id: Pane.Id, err: anyerror) void {
+ const pane = p.panes[id.index()] orelse return;
pane.shell_failed = true;
ctlfs.pty.shellGone(p, pane, false);
- p.sayShellFailure(id, err);
+ p.sayShellFailure(id.index(), err);
// A command that never started ended: `exit 127`, as a shell says of
// a command it could not run, so a follower waiting on its exit
// hears one, its tag stops saying it runs, and Kill finds nothing.
if (pane.command != null and !pane.command_done) {
pane.command_pty = false;
- pane.commandDone(p, id, 127);
+ pane.commandDone(p, id.index(), 127);
} else if (pane.command == null and !pane.had_shell) {
// A Term whose shell never ran: no dead pane left behind; the
// write that asked for it has failed with why. A terminal whose
// shell was started again (pty/ctl exec) keeps its pane.
- p.unplaced.set(id);
+ p.unplaced.set(id.index());
}
}
/// A shell started again in a terminal whose shell runs (pty/ctl's
/// exec) did not start: the host kept the running one, so only said.
pub const restartFailed = pardes.tape.taped(restartFailedInner);
-fn restartFailedInner(p: *Pardes, id: u8, err: anyerror) void {
- if (p.panes[id] == null) return;
- p.sayShellFailure(id, err);
+fn restartFailedInner(p: *Pardes, id: Pane.Id, err: anyerror) void {
+ if (p.panes[id.index()] == null) return;
+ p.sayShellFailure(id.index(), err);
}
fn sayShellFailure(p: *Pardes, id: u8, err: anyerror) void {
@@ -1379,11 +1379,11 @@ fn sayShellFailure(p: *Pardes, id: u8, err: anyerror) void {
const name = p.tape.value(.interpreter, missingInterpreter, .{ pane.shell orelse p.shellBin(), &interp });
p.reportFailure(id, if (name) |n| said.print("shell: interpreter {s} not found", .{n}) else "shell: interpreter not found");
} else {
- p.reportError(id, "shell", err);
+ p.reportError(.at(id), "shell", err);
}
// A 9P write that asked for the shell (pty/ctl's exec), waiting on
// it, fails with what was said, as a failed Save's does.
- p.noteLateFailure(id);
+ p.noteLateFailure(.at(id));
}
/// The program the shell's `#!` names that is not there, in `out`.
@@ -1406,8 +1406,8 @@ fn parentTrouble(tape: *pardes.tape.Tape, path: []const u8, err: anyerror) struc
}
pub const saveFailed = pardes.tape.taped(saveFailedInner);
-fn saveFailedInner(p: *Pardes, id: u8, path: []const u8, err: anyerror) void {
- if (p.panes[id]) |pane| if (pane.file) |*f| {
+fn saveFailedInner(p: *Pardes, id: Pane.Id, path: []const u8, err: anyerror) void {
+ if (p.panes[id.index()]) |pane| if (pane.file) |*f| {
// The `-%` spelling fs.zig already uses for "make this dirty".
f.saved_revision = f.revision -% 1;
};
@@ -1416,9 +1416,9 @@ fn saveFailedInner(p: *Pardes, id: u8, path: []const u8, err: anyerror) void {
// a mount reads as ENOENT; EACCES when one above refuses.
const parent = parentTrouble(p.tape, path, err);
if (parent.denied)
- p.reportFailure(id, what.print("Save {s}: permission denied", .{path[0..@min(path.len, limits.host_path_cap)]}))
+ p.reportFailure(id.index(), what.print("Save {s}: permission denied", .{path[0..@min(path.len, limits.host_path_cap)]}))
else if (parent.missing)
- p.reportFailure(id, what.print("Save {s}: no such directory", .{path[0..@min(path.len, limits.host_path_cap)]}))
+ p.reportFailure(id.index(), what.print("Save {s}: no such directory", .{path[0..@min(path.len, limits.host_path_cap)]}))
else
p.reportError(id, what.print("Save {s}", .{path[0..@min(path.len, limits.host_path_cap)]}), err);
p.noteLateFailure(id);
@@ -1443,10 +1443,10 @@ fn dumpFailedInner(p: *Pardes, path: []const u8, err: anyerror) void {
else if (parent.missing)
p.reportFailure(v.active, said.print("{s}: no such directory", .{operation}))
else
- p.reportError(v.active, operation, err);
+ p.reportError(.at(v.active), operation, err);
// In the words the message row has, so the write's err is the one
// record of it (its msg goes: 9p_io, dropMessage).
- p.noteLateFailure(v.active);
+ p.noteLateFailure(.at(v.active));
}
pub fn fsPayload(p: *const Pardes, r: ctlfs.Reply) []const u8 {
@@ -1683,7 +1683,7 @@ fn updateInner(p: *Pardes, ev: Event) void {
pane.command_pty = false;
} else p.removePane(e.pane, null) catch |err| {
pane.body.mode = .normal;
- p.reportError(e.pane, "terminal exited; Del retries close", err);
+ p.reportError(.at(e.pane), "terminal exited; Del retries close", err);
},
.lsp_resp => |r| @import("lsp/Ask.zig").lspResponse(p, r.id, r.rows),
.pipe_resp => |r| Pipe.pipeResponse(p, r.id, r.success, r.outputs, r.failure),
@@ -1698,12 +1698,12 @@ fn updateInner(p: *Pardes, ev: Event) void {
.mouse => |m| mouse.handleMouse(p, m),
.paste => |bytes| {
p.typedInto();
- edit.applyPaste(p, bytes) catch |err| p.reportError(v.active, "paste", err);
+ edit.applyPaste(p, bytes) catch |err| p.reportError(.at(v.active), "paste", err);
},
.command => |line| _ = p.executeBuiltinLine(v.active, line),
.focus => |focused| {
v.window_focused = focused;
- if (focused) if (p.host.vtable.newer_build) |f| if (f(p.host.ctx)) p.setMessage(v.active, newer_build_words);
+ if (focused) if (p.host.vtable.newer_build) |f| if (f(p.host.ctx)) p.setMessage(.at(v.active), newer_build_words);
},
.handed => |h| p.handover.finish(p, h.seq, h.to, h.failure),
.addon => |a| pardes.Addon.landed(p, a.op, a.pane, a.kind.*),
@@ -1812,12 +1812,12 @@ pub const SavePath = Effect.Buf(effect_path_cap);
/// What was said of a failure just now on pane `id` is also the waiting
/// 9P write's (9p_io, `fs.late_failure`).
pub const noteLateFailure = pardes.tape.taped(noteLateFailureInner);
-fn noteLateFailureInner(p: *Pardes, id: usize) void {
+fn noteLateFailureInner(p: *Pardes, id: Pane.Id) void {
// Said by reportFailure just now: its words fitted whole, the
// reason kept; else what the message row has.
const said = if (p.fs.said_at == p.fs.failures and p.fs.said_len > 0)
p.fs.said[0..p.fs.said_len]
- else if (p.panes[id]) |pane| pane.msg[0..pane.msg_len] else return;
+ else if (p.panes[id.index()]) |pane| pane.msg[0..pane.msg_len] else return;
const kept = @import("Messages.zig").clip(said, p.fs.late_failure.len);
@memcpy(p.fs.late_failure[0..kept.len], kept);
p.fs.late_failure_len = @intCast(kept.len);
@@ -1846,7 +1846,7 @@ fn windowOpacityDoneInner(p: *Pardes, applied: u8, failure: ?[]const u8) void {
// the same command will arm a new request.
p.settings.window_opacity = applied;
var buf: pardes.Kind.Buf(240 + 16) = .{};
- p.setMessage(p.view().active, buf.print("WindowOpacity: {s}", .{reason}));
+ p.setMessage(.at(p.view().active), buf.print("WindowOpacity: {s}", .{reason}));
}
/// What changed written out, at the end of a step and at the end.
@@ -1864,7 +1864,7 @@ pub fn sync(p: *Pardes) void {
// again: one logged or answered names this pane for good. Its
// rows, if it had any, go where a closed pane's go; no other
// pane moves (a pane dragged short keeps its rows).
- if (p.panes[id] != null) p.removePane(id, null) catch |err| p.reportError(v.active, "open", err);
+ if (p.panes[id] != null) p.removePane(id, null) catch |err| p.reportError(.at(v.active), "open", err);
}
// A file opened or closed this step: the kept list follows.
p.saveRecent();
@@ -2405,7 +2405,7 @@ test "pane-tag Exec prefers Term and argument builtins before shell fallback" {
const p = try Pardes.init(gpa, .{ .cols = 100, .rows = 30 });
defer p.deinit();
while (p.nextEffect()) |_| {} // initial shell spawn/geometry
- p.acknowledgeShell(0, "/bin/sh", false);
+ p.acknowledgeShell(.at(0), "/bin/sh", false);
// The Term word names the shell the host ran, and opens another of it.
const pane = p.panes[0].?;
@@ -2635,7 +2635,7 @@ test "compact tag commands stay beside their own prefix across layout changes" {
const f = layout.findPane(p, p.view().active).?;
layout.insert(p, f.col, f.idx + 1, below_id);
layout.splitBelow(p, p.view().active, below);
- p.setCwd(below_id, "/a/deep/dir/whose/name/eats/the/right/pad/the/end/of/its/own/tagline");
+ p.setCwd(.at(below_id), "/a/deep/dir/whose/name/eats/the/right/pad/the/end/of/its/own/tagline");
p.sync();
while (p.nextEffect()) |_| {}
@@ -2673,7 +2673,7 @@ test "Term spawns a raw shell in the caller's directory" {
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 100, .rows = 30 });
defer p.deinit();
while (p.nextEffect()) |_| {}
- p.setCwd(0, "/tmp/newtty-dir");
+ p.setCwd(.at(0), "/tmp/newtty-dir");
try std.testing.expect(p.executeBuiltinLine(0, "Term"));
const free = p.view().active;
@@ -2771,10 +2771,10 @@ test "unknown Exec from a document runs as a command pane in its directory, type
const p = try Pardes.init(gpa, .{});
defer p.deinit();
while (p.nextEffect()) |_| {}
- p.acknowledgeShell(0, "/bin/sh", false);
+ p.acknowledgeShell(.at(0), "/bin/sh", false);
// A terminal free at a prompt in the same directory is not borrowed.
- p.setCwd(0, "/tmp/pardes-image-dir");
+ p.setCwd(.at(0), "/tmp/pardes-image-dir");
const image_doc = try pardes.Kind.open(p, 1, pardes.Kind.test_kind.of(p), "/tmp/pardes-image-dir/pic.ppm", null);
try std.testing.expectEqualStrings("/tmp/pardes-image-dir", Pardes.paneDir(image_doc));
const dst = exec.execute(p, 1, "echo image-fallback") orelse return error.ExecFoundNowhereToRun;
@@ -2800,7 +2800,7 @@ test "Exec in a terminal whose tty is taken runs as a command pane instead of ty
defer p.deinit();
while (p.nextEffect()) |_| {}
- p.setCwd(0, "/tmp/pardes-taken");
+ p.setCwd(.at(0), "/tmp/pardes-taken");
// vim, a pager, an agent: the host answers that this pane's tty is no
// longer the prompt pardes forked
var host: FakeTtyQuery = .{};
@@ -3110,7 +3110,7 @@ test "a restored terminal's tag names neither the REPL it was nor the shell it h
const p = try Pardes.init(gpa, .{ .tty_only = true });
defer p.deinit();
while (p.nextEffect()) |_| {}
- p.acknowledgeShell(0, "/usr/bin/fish", true);
+ p.acknowledgeShell(.at(0), "/usr/bin/fish", true);
var host: FakeTtyQuery = .{};
host.install(p);
try std.testing.expect(p.executeBuiltinLine(0, "Repl python"));
@@ -3131,7 +3131,7 @@ test "a Term started by a shell's path keeps the path in its Term+ word" {
while (p.nextEffect()) |_| {}
try std.testing.expect(p.executeBuiltinLine(0, "Term /bin/sh"));
try std.testing.expect(p.view().active != 0);
- p.acknowledgeShell(p.view().active, "/bin/sh", false);
+ p.acknowledgeShell(.at(p.view().active), "/bin/sh", false);
try std.testing.expect(std.mem.startsWith(u8, tagline.curTail(p.panes[p.view().active].?), " Term+/bin/sh "));
}
@@ -3157,7 +3157,7 @@ test "Term+fish, one word a tag can hold, opens a terminal on that shell" {
try std.testing.expect(p.executeBuiltinLine(0, "Term+sh"));
try std.testing.expect(p.view().active != 0);
try std.testing.expectEqualStrings("sh", p.panes[p.view().active].?.shell.?);
- p.acknowledgeShell(p.view().active, "/bin/sh", false);
+ p.acknowledgeShell(.at(p.view().active), "/bin/sh", false);
try std.testing.expect(std.mem.startsWith(u8, tagline.curTail(p.panes[p.view().active].?), " Term+sh "));
p.view().active = 0;
// A shell that is not there is said, not quietly replaced, and the
@@ -3184,7 +3184,7 @@ test "a command pane shows how its command ended, and the next command there run
const p = try Pardes.init(gpa, .{});
defer p.deinit();
while (p.nextEffect()) |_| {}
- p.setCwd(0, "/tmp/pardes-cmd");
+ p.setCwd(.at(0), "/tmp/pardes-cmd");
_ = try pardes.Kind.open(p, 1, pardes.Kind.test_kind.of(p), "/tmp/pardes-cmd/pic.ppm", null);
const dst = exec.execute(p, 1, "make -j8") orelse return error.NoCommandPane;
@@ -3283,9 +3283,9 @@ test "a terminal its program gave back takes command lines again" {
const p = try Pardes.init(gpa, .{});
defer p.deinit();
while (p.nextEffect()) |_| {}
- p.acknowledgeShell(0, "/bin/sh", false);
+ p.acknowledgeShell(.at(0), "/bin/sh", false);
- p.setCwd(0, "/tmp/pardes-taken-flip");
+ p.setCwd(.at(0), "/tmp/pardes-taken-flip");
var host: FakeTtyQuery = .{};
host.install(p);
host.taken[0] = true;
@@ -3321,9 +3321,9 @@ test "the host is asked about a tty only where a command line is about to go" {
var host: FakeTtyQuery = .{};
host.install(p);
- p.setCwd(0, "/tmp/pardes-lazy-a");
- p.setCwd(1, "/tmp/pardes-lazy-b");
- p.setCwd(2, "/tmp/pardes-lazy-c");
+ p.setCwd(.at(0), "/tmp/pardes-lazy-a");
+ p.setCwd(.at(1), "/tmp/pardes-lazy-b");
+ p.setCwd(.at(2), "/tmp/pardes-lazy-c");
_ = try p.render(frame.allocator());
p.update(.{ .key = .{ .cp = 'x' } });