diff options
Diffstat (limited to 'src')
| -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")); +} |
