summaryrefslogtreecommitdiff
path: root/src/ninep/events.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/events.zig')
-rw-r--r--src/ninep/events.zig10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ninep/events.zig b/src/ninep/events.zig
index ebd1cd2c..fa0a4975 100644
--- a/src/ninep/events.zig
+++ b/src/ninep/events.zig
@@ -128,6 +128,7 @@ pub fn noteInstall(p: *Pardes, id: usize) void {
/// A pane leaving; one never announced leaves silently.
pub fn noteRetire(p: *Pardes, id: usize, pane: *Pane) void {
if (id >= MAX_PANES) return;
+ tree.pty.shellGone(p, id);
if (p.fs.panes[id].unannounced) {
p.fs.panes[id].unannounced = false;
return;
@@ -168,10 +169,11 @@ fn pushLog(p: *Pardes, record: []u8) void {
c.* = ' ';
};
// One record larger than the ring would push every other out and then
- // not fit itself; cut it to what fits instead.
- const fit = @min(record.len, p.fs.log.cap - 4);
- record[fit - 1] = '\n';
- p.fs.log.push(p.gpa, record[0..fit]);
+ // not fit itself; cut it to what fits instead, on a character boundary.
+ var end = @min(record.len, p.fs.log.cap - 4) - 1;
+ while (end > 0 and record[end] & 0xC0 == 0x80) end -= 1;
+ record[end] = '\n';
+ p.fs.log.push(p.gpa, record[0 .. end + 1]);
}
/// An open freezes the ring's text, so `cat log` answers what happened lately