diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 05:12:57 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 05:18:09 -0300 |
| commit | 6ec5935396f2a5584f464bb256de88c501ab6bf1 (patch) | |
| tree | 3f819bae03fce34bbec695f7873bbbe1488a9116 /src/ninep/events.zig | |
| parent | d378de9c497f46090a3d0d30508f504eae5cd48f (diff) | |
| download | pardes-6ec5935396f2a5584f464bb256de88c501ab6bf1.tar.gz pardes-6ec5935396f2a5584f464bb256de88c501ab6bf1.zip | |
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 <[email protected]>
Diffstat (limited to 'src/ninep/events.zig')
| -rw-r--r-- | src/ninep/events.zig | 12 |
1 files changed, 11 insertions, 1 deletions
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 <serial> <text>` 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")); +} |
