From 6ec5935396f2a5584f464bb256de88c501ab6bf1 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 05:12:57 -0300 Subject: A msg record carries what was said, not the message row's clock: `msg 21 dumped themes ...`, no `04:39:41 ` before it Messages a host stamps (saved, reloaded, dumped themes) went into the log with their clock and its double blank. The log has no times; noteMessage records the words after the stamp (Message.body). Co-Authored-By: Claude Opus 5.5 --- src/ninep/events.zig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ninep/events.zig b/src/ninep/events.zig index d60c07ad..10e91138 100644 --- a/src/ninep/events.zig +++ b/src/ninep/events.zig @@ -181,7 +181,10 @@ pub fn noteLogAs(p: *Pardes, kind: LogKind, pane: *Pane, path: []const u8) void /// Records `msg ` for what the editor said, `-` for no pane. /// Text past LoggedMessage.cap bytes is cut between words with an ellipsis, /// as an err record's reason is. -pub fn noteMessage(p: *Pardes, serial: u32, said: []const u8) void { +pub fn noteMessage(p: *Pardes, serial: u32, said_stamped: []const u8) void { + // The message row's clock (`04:39:41 dumped themes`) is not the + // record's: the log has no times, and a script reads the words. + const said = pardes.Messages.Message.body(said_stamped); 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 ""; @@ -1502,3 +1505,10 @@ test "two failures that agree only in what their records cut are two records, no p.setMessage(0, long ++ "second"); try testing.expect(th.logHas(p, "(x2)")); } + +test "a message the host stamped with its clock is recorded without it" { + const p = try withFile(testing.allocator, "x\n"); + defer p.deinit(); + noteMessage(p, 7, "04:39:41 dumped themes /tmp/t"); + try testing.expect(th.logHas(p, "msg 7 dumped themes /tmp/t\n")); +} -- cgit v1.3