summaryrefslogtreecommitdiff
path: root/core/builtins.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/builtins.zig')
-rw-r--r--core/builtins.zig124
1 files changed, 62 insertions, 62 deletions
diff --git a/core/builtins.zig b/core/builtins.zig
index 7add3d9c..6f37e86d 100644
--- a/core/builtins.zig
+++ b/core/builtins.zig
@@ -447,7 +447,7 @@ pub const Kill = struct {
// the marks say is running is the one signalled, not whatever
// runs by then.
if (command != null) {
- c.p.emit(.{ .signal_pty = .{ .pane = @intCast(id), .serial = pane.serial, .sig = .term } });
+ c.p.emit(.{ .signal_pty = .{ .pane = .at(id), .serial = pane.serial, .sig = .term } });
stopped = true;
} else if (c.p.hostKillJob(id)) stopped = true else jobless = true;
}
@@ -458,7 +458,7 @@ pub const Kill = struct {
if (names.len > 0 and running)
c.p.reportFailure(c.id, "Kill: no running command has that first word")
else
- c.p.setMessage(c.id, "Kill: nothing running");
+ c.p.setMessage(.at(c.id), "Kill: nothing running");
}
};
@@ -477,7 +477,7 @@ pub const Dump = struct {
to = path;
}
// Never a Dump said done that wrote nothing: its failure is said.
- dump.dumpTo(c.p, to) catch |err| c.p.reportError(c.id, "Dump", err);
+ dump.dumpTo(c.p, to) catch |err| c.p.reportError(.at(c.id), "Dump", err);
}
};
@@ -537,7 +537,7 @@ pub const Detach = struct {
pub const scope: Scope = .session;
pub const enabled = pardes.can_attach;
pub fn run(c: Ctx) void {
- c.p.emit(.{ .detach = .{ .pane = @intCast(c.id) } });
+ c.p.emit(.{ .detach = .{ .pane = .at(c.id) } });
}
};
@@ -548,7 +548,7 @@ pub const Adopt = struct {
pub const enabled = pardes.can_attach;
pub fn run(c: Ctx) void {
const adopt = c.p.host.vtable.adopt orelse return c.p.reportFailure(c.id, "Adopt: no pardes daemon is keeping shells for this session");
- adopt(c.p.host.ctx, @intCast(c.id));
+ adopt(c.p.host.ctx, .at(c.id));
}
};
@@ -560,7 +560,7 @@ pub const Upgrade = struct {
pub const enabled = pardes.can_attach;
pub fn run(c: Ctx) void {
const upgrade = c.p.host.vtable.upgrade orelse return c.p.reportFailure(c.id, "Upgrade: this pardes cannot move to another build in place");
- upgrade(c.p.host.ctx, @intCast(c.id));
+ upgrade(c.p.host.ctx, .at(c.id));
}
};
@@ -578,7 +578,7 @@ pub const Mount = struct {
c.p.fs.mount(c.p.gpa, name, dial) catch |err| {
var said: pardes.Kind.Buf(200) = .{};
if (err == error.BadDial) return c.p.reportFailure(c.id, said.print("Mount: bad dial address: {s} (unix!/path, /path, tcp!<numeric-ip>!<port>, or a session name)", .{dial[0..@min(dial.len, 100)]}));
- return c.p.reportError(c.id, "Mount", err);
+ return c.p.reportError(.at(c.id), "Mount", err);
};
// A socket path that is not there: said so (ENOENT), not a dial
// that went unanswered.
@@ -600,7 +600,7 @@ pub const Mount = struct {
c.p.gpa.free(gone.dial);
}
var what: pardes.Kind.Buf(160) = .{};
- return c.p.reportError(c.id, what.print("Mount {s} {s}", .{ name[0..@min(name.len, 32)], dial }), err);
+ return c.p.reportError(.at(c.id), what.print("Mount {s} {s}", .{ name[0..@min(name.len, 32)], dial }), err);
};
}
};
@@ -612,15 +612,15 @@ pub const Unmount = struct {
pub const requires_arg = true;
pub fn run(c: Ctx) void {
var args = std.mem.tokenizeAny(u8, c.arg orelse "", " \t");
- const name = args.next() orelse return c.p.reportError(c.id, "Unmount name", error.MissingArgument);
- if (args.next() != null) return c.p.reportError(c.id, "Unmount name", error.TooManyArguments);
+ const name = args.next() orelse return c.p.reportError(.at(c.id), "Unmount name", error.MissingArgument);
+ if (args.next() != null) return c.p.reportError(.at(c.id), "Unmount name", error.TooManyArguments);
pardes.filesystem.unmount(c.p, name) catch |err| {
// "no such": the words 9ns reads as ENOENT.
if (err == error.NotMounted) {
var said: pardes.Kind.Buf(96) = .{};
return c.p.reportFailure(c.id, said.print("Unmount: no such mount {s}", .{name}));
}
- return c.p.reportError(c.id, "Unmount", err);
+ return c.p.reportError(.at(c.id), "Unmount", err);
};
}
};
@@ -634,9 +634,9 @@ pub const Msg = struct {
pub const quiet = true; // it IS the message row
pub fn run(c: Ctx) void {
if (c.arg) |text|
- c.p.setMessage(c.id, text)
+ c.p.setMessage(.at(c.id), text)
else
- c.p.reportError(c.id, comptime word(@This()), error.NoMessage);
+ c.p.reportError(.at(c.id), comptime word(@This()), error.NoMessage);
}
};
@@ -653,7 +653,7 @@ pub const Themes = struct {
pub const scope: Scope = .session;
pub const output: OutputTraits = .{ .name = config.themes_buffer, .steps = true, .commands = true };
pub fn run(c: Ctx) void {
- panes.Output.openThemes(c.p, c.id) catch |err| c.p.reportError(c.id, "themes", err);
+ panes.Output.openThemes(c.p, c.id) catch |err| c.p.reportError(.at(c.id), "themes", err);
}
};
@@ -679,10 +679,10 @@ pub const DumpThemes = struct {
pub const scope: Scope = .session;
pub fn run(c: Ctx) void {
if (c.p.configDir() == null) {
- c.p.reportError(c.id, "dump themes", error.NoConfigDirectory);
+ c.p.reportError(.at(c.id), "dump themes", error.NoConfigDirectory);
return;
}
- c.p.emit(.{ .dump_themes = .{ .pane = @intCast(c.id) } });
+ c.p.emit(.{ .dump_themes = .{ .pane = .at(c.id) } });
}
};
@@ -694,7 +694,7 @@ pub const Fonts = struct {
pub const gui_only = true;
pub const in_window = true;
pub fn run(c: Ctx) void {
- panes.Output.openFonts(c.p, c.id) catch |err| c.p.reportError(c.id, "fonts", err);
+ panes.Output.openFonts(c.p, c.id) catch |err| c.p.reportError(.at(c.id), "fonts", err);
}
};
@@ -709,7 +709,7 @@ pub const TreeContext = struct {
const file = &c.pane.file.?;
const arg = std.mem.trim(u8, c.arg orelse "", " \t\r\n");
const on = if (arg.len == 0) !file.tree_context else if (std.mem.eql(u8, arg, "on")) true else if (std.mem.eql(u8, arg, "off")) false else {
- c.p.reportError(c.id, "TreeContext", error.ExpectedOnOrOff);
+ c.p.reportError(.at(c.id), "TreeContext", error.ExpectedOnOrOff);
return;
};
file.tree_context = on;
@@ -845,7 +845,7 @@ pub const Get = struct {
}
if (!panes.Output.fileTraits(f.output).saves) return c.p.reportFailure(c.id, "Get: only a file pane takes it");
var home_buf: [4096]u8 = undefined;
- const path = if (typed.len == 0) c.pane.file.?.path else std.Io.Dir.path.resolvePosix(c.p.scratch.allocator(), &.{ Pardes.paneDir(c.pane), c.p.expandHome(typed, &home_buf) }) catch |err| return c.p.reportError(c.id, "Get", err);
+ const path = if (typed.len == 0) c.pane.file.?.path else std.Io.Dir.path.resolvePosix(c.p.scratch.allocator(), &.{ Pardes.paneDir(c.pane), c.p.expandHome(typed, &home_buf) }) catch |err| return c.p.reportError(.at(c.id), "Get", err);
// A file that is not there, or a directory, is said before unsaved
// edits are asked about: there would be nothing to load over them.
if (typed.len > 0) if (@import("fs.zig").localPath(path)) |local| {
@@ -896,7 +896,7 @@ pub const Incl = struct {
if (std.mem.eql(u8, typed, "-")) {
for (p.incl.items) |dir| p.gpa.free(dir);
p.incl.clearRetainingCapacity();
- return p.setMessage(c.id, "Incl: none");
+ return p.setMessage(.at(c.id), "Incl: none");
}
// All checked before any is taken: `-` clears, alone; a directory
// is absolute (or ~) and there.
@@ -918,24 +918,24 @@ pub const Incl = struct {
var words = std.mem.tokenizeAny(u8, typed, " \t");
while (words.next()) |dir_word| {
var home_buf: [4096]u8 = undefined;
- const full = std.Io.Dir.path.resolvePosix(p.scratch.allocator(), &.{ Pardes.paneDir(c.pane), p.expandHome(dir_word, &home_buf) }) catch |err| return p.reportError(c.id, "Incl", err);
+ const full = std.Io.Dir.path.resolvePosix(p.scratch.allocator(), &.{ Pardes.paneDir(c.pane), p.expandHome(dir_word, &home_buf) }) catch |err| return p.reportError(.at(c.id), "Incl", err);
if (!std.Io.Dir.path.isAbsolute(full)) return p.reportFailure(c.id, "Incl: invalid directory");
for (p.incl.items) |dir| {
if (std.mem.eql(u8, dir, full)) break;
} else {
- const copy = p.gpa.dupe(u8, full) catch |err| return p.reportError(c.id, "Incl", err);
+ const copy = p.gpa.dupe(u8, full) catch |err| return p.reportError(.at(c.id), "Incl", err);
p.incl.append(p.gpa, copy) catch |err| {
p.gpa.free(copy);
- return p.reportError(c.id, "Incl", err);
+ return p.reportError(.at(c.id), "Incl", err);
};
}
}
if (typed.len > 0) return;
var list: std.Io.Writer.Allocating = .init(p.scratch.allocator());
- list.writer.writeAll("Incl:") catch |err| return p.reportError(c.id, "Incl", err);
- for (p.incl.items) |dir| list.writer.print(" {s}", .{dir}) catch |err| return p.reportError(c.id, "Incl", err);
- if (p.incl.items.len == 0) list.writer.writeAll(" none") catch |err| return p.reportError(c.id, "Incl", err);
- p.setMessage(c.id, list.written());
+ list.writer.writeAll("Incl:") catch |err| return p.reportError(.at(c.id), "Incl", err);
+ for (p.incl.items) |dir| list.writer.print(" {s}", .{dir}) catch |err| return p.reportError(.at(c.id), "Incl", err);
+ if (p.incl.items.len == 0) list.writer.writeAll(" none") catch |err| return p.reportError(.at(c.id), "Incl", err);
+ p.setMessage(.at(c.id), list.written());
}
};
@@ -961,8 +961,8 @@ pub const Zerox = struct {
if (@import("edit_cmd.zig").busyOn(c.p, c.id)) return c.p.reportFailure(c.id, "Zerox: " ++ @import("edit_cmd.zig").e_busy);
const f = c.pane.file orelse return c.p.reportFailure(c.id, "Zerox: only a file pane takes it");
if (f.output != null or f.listing != null or f.mini != null) return c.p.reportFailure(c.id, "Zerox: only a file pane takes it");
- const free = c.p.freeSlot() orelse return c.p.reportError(c.id, "Zerox", error.NoPaneSlots);
- _ = panes.File.zerox(c.p, c.id, free) catch |err| return c.p.reportError(c.id, "Zerox", err);
+ const free = c.p.freeSlot() orelse return c.p.reportError(.at(c.id), "Zerox", error.NoPaneSlots);
+ _ = panes.File.zerox(c.p, c.id, free) catch |err| return c.p.reportError(.at(c.id), "Zerox", err);
layout.placeNew(c.p, c.id, c.id, free, .doc);
}
};
@@ -1022,7 +1022,7 @@ pub const Del = struct {
// about once, and the same Del again, nothing edited since, closes.
if (warnModifiedIn(c, .Del, .{ .pane = c.id })) return;
// An attachment's rows go back to its owner: nothing to ask.
- if (layout.ownerOf(c.p, c.id)) |owner| return c.p.removePane(c.id, owner) catch |err| c.p.reportError(c.id, "close", err);
+ if (layout.ownerOf(c.p, c.id)) |owner| return c.p.removePane(c.id, owner) catch |err| c.p.reportError(.at(c.id), "close", err);
const at = layout.findPane(c.p, c.id);
const above = if (at) |f| layout.expandedNeighbor(c.p, f.col, f.idx, .above) else null;
// An owner's attachments close with it: below is past them.
@@ -1052,7 +1052,7 @@ pub const Del = struct {
if (c.pane.msg_announcement) c.pane.msg_len = 0;
return;
}
- c.p.removePane(c.id, to) catch |err| return c.p.reportError(c.id, "close", err);
+ c.p.removePane(c.id, to) catch |err| return c.p.reportError(.at(c.id), "close", err);
}
};
@@ -1110,8 +1110,8 @@ pub const Edit = struct {
pub const Undo = struct {
pub fn run(c: Ctx) void {
if (@import("edit_cmd.zig").busyOn(c.p, c.id)) return c.p.reportFailure(c.id, "Undo: " ++ @import("edit_cmd.zig").e_busy);
- if (c.pane.file) |f| if (f.history.journal.done == 0) return c.p.setMessage(c.id, "Undo: nothing to undo");
- edit.undoStep(c.p.editor(), &c.pane.body, true) catch |err| c.p.reportError(c.id, "Undo", err);
+ if (c.pane.file) |f| if (f.history.journal.done == 0) return c.p.setMessage(.at(c.id), "Undo: nothing to undo");
+ edit.undoStep(c.p.editor(), &c.pane.body, true) catch |err| c.p.reportError(.at(c.id), "Undo", err);
}
};
@@ -1119,8 +1119,8 @@ pub const Undo = struct {
pub const Redo = struct {
pub fn run(c: Ctx) void {
if (@import("edit_cmd.zig").busyOn(c.p, c.id)) return c.p.reportFailure(c.id, "Redo: " ++ @import("edit_cmd.zig").e_busy);
- if (c.pane.file) |f| if (f.history.journal.done == f.history.journal.steps.items.len) return c.p.setMessage(c.id, "Redo: nothing to redo");
- edit.undoStep(c.p.editor(), &c.pane.body, false) catch |err| c.p.reportError(c.id, "Redo", err);
+ if (c.pane.file) |f| if (f.history.journal.done == f.history.journal.steps.items.len) return c.p.setMessage(.at(c.id), "Redo: nothing to redo");
+ edit.undoStep(c.p.editor(), &c.pane.body, false) catch |err| c.p.reportError(.at(c.id), "Redo", err);
}
};
@@ -1150,7 +1150,7 @@ pub const Delcol = struct {
// acme's Delcol refuses a column with unsaved text (exec.c delcol,
// cols.c colclean), once: the next Delcol closes it.
if (warnModifiedIn(c, .Delcol, .{ .column = col })) return;
- layout.removeColumn(c.p, col) catch |err| c.p.reportError(c.id, "close column", err);
+ layout.removeColumn(c.p, col) catch |err| c.p.reportError(.at(c.id), "close column", err);
}
};
@@ -1216,12 +1216,12 @@ pub const Repl = struct {
var buf: pardes.Kind.Buf(320) = .{};
var idbuf: [48]u8 = undefined;
if (arg.len == 0) {
- if (pane.repl == null) return c.p.setMessage(c.id, "Repl: not bound");
- return c.p.setMessage(c.id, buf.print("Repl: {s}", .{exec.replId(&idbuf, pane)}));
+ if (pane.repl == null) return c.p.setMessage(.at(c.id), "Repl: not bound");
+ return c.p.setMessage(.at(c.id), buf.print("Repl: {s}", .{exec.replId(&idbuf, pane)}));
}
if (std.mem.eql(u8, arg, "-")) {
pane.repl = null;
- return c.p.setMessage(c.id, "Repl: unbound");
+ return c.p.setMessage(.at(c.id), "Repl: unbound");
}
const manifest = @import("grammar_manifest.zig");
const grammars = manifest.all;
@@ -1252,7 +1252,7 @@ pub const Repl = struct {
return c.p.reportFailure(c.id, w.buffered());
};
if (pane.repl) |r| if (r.lang == lang)
- return c.p.setMessage(c.id, buf.print("Repl: {s}", .{exec.replId(&idbuf, pane)}));
+ return c.p.setMessage(.at(c.id), buf.print("Repl: {s}", .{exec.replId(&idbuf, pane)}));
// The lowest letter no other REPL of the language has: freed ones
// come back.
var letter: u8 = 'a';
@@ -1266,7 +1266,7 @@ pub const Repl = struct {
if (letter > 'z') return c.p.reportFailure(c.id, "Repl: every letter of the language is taken");
pane.repl = .{ .lang = lang, .letter = letter };
pane.repl_warned = false;
- c.p.setMessage(c.id, buf.print("Repl: {s}", .{exec.replId(&idbuf, pane)}));
+ c.p.setMessage(.at(c.id), buf.print("Repl: {s}", .{exec.replId(&idbuf, pane)}));
}
};
@@ -1289,8 +1289,8 @@ pub const Joincol = struct {
pub const Tutor = struct {
pub const scope: Scope = .session;
pub fn run(c: Ctx) void {
- const free = c.p.freeSlot() orelse return c.p.reportError(c.id, "Tutor", error.NoPaneSlots);
- _ = panes.openTutorView(c.p, free) catch |err| return c.p.reportError(c.id, "Tutor", err);
+ const free = c.p.freeSlot() orelse return c.p.reportError(.at(c.id), "Tutor", error.NoPaneSlots);
+ _ = panes.openTutorView(c.p, free) catch |err| return c.p.reportError(.at(c.id), "Tutor", err);
layout.placeNew(c.p, c.id, c.id, free, .doc); // a doc like any other
}
};
@@ -1300,7 +1300,7 @@ pub const Help = struct {
pub const scope: Scope = .session;
pub const output: OutputTraits = .{ .name = config.help_buffer };
pub fn run(c: Ctx) void {
- panes.Output.openHelp(c.p, c.id, "") catch |err| c.p.reportError(c.id, "help", err);
+ panes.Output.openHelp(c.p, c.id, "") catch |err| c.p.reportError(.at(c.id), "help", err);
}
};
@@ -1331,10 +1331,10 @@ fn openConfigFile(c: Ctx, name: []const u8, path: []const u8, initial: []const u
}
if (real != null) return look.lookAt(c.p, c.id, path);
// Not there yet: a pane named for it, which Save makes.
- const free = c.p.freeSlot() orelse return c.p.reportError(c.id, name, error.NoPaneSlots);
+ const free = c.p.freeSlot() orelse return c.p.reportError(.at(c.id), name, error.NoPaneSlots);
panes.newScratchFor(c.p, c.id, .scratch);
const made = c.p.panes[free] orelse return;
- @import("ninep/pane.zig").nameBuffer(c.p, free, path, false) catch |err| return c.p.reportError(c.id, name, err);
+ @import("ninep/pane.zig").nameBuffer(c.p, free, path, false) catch |err| return c.p.reportError(.at(c.id), name, err);
if (initial.len > 0) if (made.file) |*f| {
_ = panes.File.replace(c.p, f, 0, f.content.len, initial);
};
@@ -1347,7 +1347,7 @@ pub const DumpConfig = struct {
pub const scope: Scope = .session;
pub const output: OutputTraits = .{ .name = config.dump_config_buffer };
pub fn run(c: Ctx) void {
- panes.Output.openConfig(c.p, c.id) catch |err| c.p.reportError(c.id, "config", err);
+ panes.Output.openConfig(c.p, c.id) catch |err| c.p.reportError(.at(c.id), "config", err);
}
};
@@ -1360,14 +1360,14 @@ pub const LocationsConfig = struct {
pub fn run(c: Ctx) void {
const argument = std.mem.trim(u8, c.arg orelse "", " \t\r\n");
const next = c.p.locations_config.parse(argument) catch |err| {
- c.p.reportError(c.id, "LocationsConfig", err);
+ c.p.reportError(.at(c.id), "LocationsConfig", err);
return;
};
c.p.locations_config = next;
// Bare, it is a question, and the window is the answer. With arguments
// it is a setting, and a setting that opens a window is noise.
if (argument.len != 0) return;
- report(c) catch |err| c.p.reportError(c.id, "LocationsConfig", err);
+ report(c) catch |err| c.p.reportError(.at(c.id), "LocationsConfig", err);
}
fn report(c: Ctx) !void {
@@ -1387,7 +1387,7 @@ pub const Messages = struct {
pub const scope: Scope = .session;
pub const output: OutputTraits = .{ .name = config.messages_buffer };
pub fn run(c: Ctx) void {
- panes.Output.openMessages(c.p, c.id) catch |err| c.p.reportError(c.id, "messages", err);
+ panes.Output.openMessages(c.p, c.id) catch |err| c.p.reportError(.at(c.id), "messages", err);
}
};
@@ -1399,7 +1399,7 @@ pub const Build = struct {
pub const scope: Scope = .session;
pub const output: OutputTraits = .{ .name = config.build_buffer };
pub fn run(c: Ctx) void {
- panes.Output.openBuild(c.p, c.id) catch |err| c.p.reportError(c.id, "build", err);
+ panes.Output.openBuild(c.p, c.id) catch |err| c.p.reportError(.at(c.id), "build", err);
}
};
@@ -1409,7 +1409,7 @@ pub const Changelog = struct {
pub const scope: Scope = .session;
pub const output: OutputTraits = .{ .name = config.changelog_buffer };
pub fn run(c: Ctx) void {
- panes.Output.openChangelog(c.p, c.id) catch |err| c.p.reportError(c.id, "changelog", err);
+ panes.Output.openChangelog(c.p, c.id) catch |err| c.p.reportError(.at(c.id), "changelog", err);
}
};
@@ -1421,7 +1421,7 @@ pub const Mini = struct {
pub fn run(c: Ctx) void {
panes.mini.open(c.p, c.id, c.arg orelse "") catch |err|
- c.p.reportError(c.id, "Mini", err);
+ c.p.reportError(.at(c.id), "Mini", err);
}
};
@@ -1577,8 +1577,8 @@ pub const Follow = struct {
};
if (!f.follow and last != c.id) return c.p.reportFailure(c.id, "Follow: this text has a chain: Follow on one of its panes");
const col = (layout.findPane(c.p, last) orelse return c.p.reportFailure(c.id, "Follow: the pane is not laid out")).col;
- const free = c.p.freeSlot() orelse return c.p.reportError(c.id, "Follow", error.NoPaneSlots);
- const made = panes.File.zerox(c.p, c.id, free) catch |err| return c.p.reportError(c.id, "Follow", err);
+ const free = c.p.freeSlot() orelse return c.p.reportError(.at(c.id), "Follow", error.NoPaneSlots);
+ const made = panes.File.zerox(c.p, c.id, free) catch |err| return c.p.reportError(.at(c.id), "Follow", err);
const keep = v.active;
if (col + 1 < v.ncol) {
c.p.exec_column = col + 1;
@@ -1596,7 +1596,7 @@ pub const Follow = struct {
made.file.?.follow = true;
c.pane.follow_scroll = f.scroll;
made.follow_scroll = made.file.?.scroll;
- made.appendTag(" Unfollow") catch |err| c.p.reportError(c.id, "Follow", err);
+ made.appendTag(" Unfollow") catch |err| c.p.reportError(.at(c.id), "Follow", err);
}
};
@@ -1694,7 +1694,7 @@ pub const History = struct {
panes.Output.openHistory(c.p, c.id) catch |err| switch (err) {
error.NoStateFile => c.p.reportFailure(c.id, "History: no state file to list (DumpDir)"),
error.NoDumps => c.p.reportFailure(c.id, "History: no dumps yet"),
- else => c.p.reportError(c.id, "History", err),
+ else => c.p.reportError(.at(c.id), "History", err),
};
}
};
@@ -1704,7 +1704,7 @@ pub const Jumplist = struct {
pub const scope: Scope = .session;
pub const output: OutputTraits = .{ .name = config.jumps_buffer, .steps = true, .locations = true };
pub fn run(c: Ctx) void {
- panes.Output.openJumps(c.p, c.id) catch |err| c.p.reportError(c.id, "jumplist", err);
+ panes.Output.openJumps(c.p, c.id) catch |err| c.p.reportError(.at(c.id), "jumplist", err);
}
};
@@ -2011,7 +2011,7 @@ test "Kill stops the commands pardes typed, bare all and by name those that matc
const term = p.view().active;
try std.testing.expect(p.panes[term].?.isTerminal());
const prompt = "\x1b]133;A;cl=line;aid=pardes\x07$ \x1b]133;B;aid=pardes\x07";
- p.update(.{ .output = .{ .pane = @intCast(term), .bytes = prompt } });
+ p.update(.{ .output = .{ .pane = .at(term), .bytes = prompt } });
while (p.nextEffect()) |_| {}
// The host the core asks: how many it was asked to stop, and whether
// their shells run jobs in groups of their own.
@@ -2019,7 +2019,7 @@ test "Kill stops the commands pardes typed, bare all and by name those that matc
var asked: usize = 0;
var job_control = true;
const vtable: pardes.Host.VTable = .{ .kill_job = answer };
- fn answer(_: ?*anyopaque, _: u8) bool {
+ fn answer(_: ?*anyopaque, _: pardes.Pane.Id) bool {
asked += 1;
return job_control;
}
@@ -2037,7 +2037,7 @@ test "Kill stops the commands pardes typed, bare all and by name those that matc
while (p.nextEffect()) |_| {}
// Typed but not started yet (no C mark): not running.
try std.testing.expectEqual(@as(usize, 0), killed.count(p, "Kill"));
- p.update(.{ .output = .{ .pane = @intCast(term), .bytes = "\x1b]133;C;aid=pardes\x07" } });
+ p.update(.{ .output = .{ .pane = .at(term), .bytes = "\x1b]133;C;aid=pardes\x07" } });
while (p.nextEffect()) |_| {}
try std.testing.expectEqual(@as(usize, 0), killed.count(p, "Kill ls"));
try std.testing.expectEqual(@as(usize, 1), killed.count(p, "Kill ls make"));
@@ -2053,7 +2053,7 @@ test "Kill stops the commands pardes typed, bare all and by name those that matc
p.fs.failure_len = 0;
killed.job_control = true;
// Ended (a D mark): nothing to stop again.
- p.update(.{ .output = .{ .pane = @intCast(term), .bytes = "\x1b]133;D;143;aid=pardes\x07" ++ prompt } });
+ p.update(.{ .output = .{ .pane = .at(term), .bytes = "\x1b]133;D;143;aid=pardes\x07" ++ prompt } });
while (p.nextEffect()) |_| {}
try std.testing.expectEqual(@as(usize, 0), killed.count(p, "Kill"));
}