summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/exec.zig12
-rw-r--r--src/ninep/events.zig8
2 files changed, 17 insertions, 3 deletions
diff --git a/src/exec.zig b/src/exec.zig
index 9e46b434..421bfd13 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -824,10 +824,8 @@ pub fn applyStartupConfig(p: *Pardes) void {
}
test "an init file's ThemeSel runs as Themes and says it was renamed" {
- const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 });
+ const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24, .startup_config = "ThemeSel\n" });
defer p.deinit();
- p.opts.startup_config = "ThemeSel\n";
- applyStartupConfig(p);
var listed = false;
for (p.panes) |slot| if (slot) |pane| if (pane.file) |f| if (f.output) |o| {
listed = listed or std.meta.eql(o.from, panes.Output.Origin{ .cmd = .Themes });
@@ -838,6 +836,14 @@ test "an init file's ThemeSel runs as Themes and says it was renamed" {
said = said or std.mem.eql(u8, pane.msg[0..pane.msg_len], "ThemeSel: renamed to Themes");
};
try std.testing.expect(said);
+ // The panes there at boot are the log's first records, before what the
+ // init file said.
+ const th = @import("ninep/testing.zig");
+ const log = @intFromEnum(pardes.ctlfs.TopFile.log);
+ const h = th.call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle;
+ defer _ = th.call(p, .{ .tag = 3, .op = .release, .node = log, .handle = h });
+ const text = th.call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes;
+ try std.testing.expectStringStartsWith(text, "new ");
}
test "an init file's retired ColumnTags line is said and ignored" {
diff --git a/src/ninep/events.zig b/src/ninep/events.zig
index 95b4926e..2fe25071 100644
--- a/src/ninep/events.zig
+++ b/src/ninep/events.zig
@@ -145,6 +145,12 @@ pub fn announce(p: *Pardes) void {
}
}
+/// The panes present at boot are the log's first records: something said
+/// before the first update ends (an init file's notice) waits for them.
+fn bootFirst(p: *Pardes) void {
+ if (newest(p) == null) announce(p);
+}
+
/// Records `<kind> <serial> <name>`.
pub fn noteLog(p: *Pardes, kind: LogKind, pane: *Pane) void {
var buf: [4 * 4096 + 64]u8 = undefined;
@@ -161,6 +167,7 @@ pub fn noteMessage(p: *Pardes, serial: u32, said: []const u8) void {
var buf: [pardes.Messages.LoggedMessage.cap + 32]u8 = undefined;
const kept = pardes.Messages.clip(said, pardes.Messages.LoggedMessage.cap);
const cut = if (kept.len < said.len) "…" else "";
+ bootFirst(p);
pushCounting(p, (if (serial == 0)
std.fmt.bufPrint(&buf, "msg - {s}{s}\n", .{ kept, cut })
else
@@ -175,6 +182,7 @@ pub fn noteMessage(p: *Pardes, serial: u32, said: []const u8) void {
/// `dump <path>` when a Dump is written, `restore <path>` first in a
/// Restore's replacement.
pub fn notePath(p: *Pardes, what: []const u8, path: []const u8) void {
+ bootFirst(p);
var buf: [pardes.memory.limits.host_path_cap + 16]u8 = undefined;
pushLog(p, std.fmt.bufPrint(&buf, "{s} {s}\n", .{ what, path }) catch return);
}