summaryrefslogtreecommitdiff
path: root/src/ninep/pane.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/pane.zig')
-rw-r--r--src/ninep/pane.zig9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index ce246465..b77d72d7 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -300,7 +300,7 @@ pub fn spliceBody(p: *Pardes, pane: *Pane, q0: usize, q1: usize, bytes: []const
if (std.mem.eql(u8, f.content[lo..hi], bytes[0..take])) return take;
const join = pane.fs.joined == f.revision;
pane.fs.joined = null;
- if (!pane.fs.nomark and !join) panes.File.pushUndo(p, pane);
+ if (!pane.fs.nomark and !join) panes.File.pushUndo(p, pane) catch return null;
if (!panes.File.replace(p, f, lo, hi - lo, bytes[0..take])) return null;
return take;
}
@@ -652,9 +652,10 @@ pub fn applyTagTruncation(p: *Pardes, pane: *Pane) void {
const pf = &pane.fs;
if (!pf.tag_trunc_pending) return;
pf.tag_trunc_pending = false;
- const empty = p.gpa.alloc(u8, 0) catch return;
// An edit like a keyboard one: `u` in the tag brings it back.
- pane.tag.remember(p.gpa, if (pane.tag.own) |own| .{ .text = own } else null);
+ pane.tag.remember(p.gpa, if (pane.tag.own) |own| .{ .text = own } else null) catch |err|
+ return p.reportError(p.paneBySerial(pane.serial) orelse return, "tag", err);
+ const empty = p.gpa.alloc(u8, 0) catch unreachable; // no byte: the allocator is not asked
if (pane.tag.own) |own| p.gpa.free(own);
pane.tag.own = empty;
// what is left is the prefix; the cursor goes after it
@@ -800,7 +801,7 @@ fn writeFlag(p: *Pardes, req: Req, pane: *Pane, file: PaneFile) Reply {
// step starts here: the text as it is now is what Undo brings back,
// and turning mark on again only ends it.
.mark => {
- if (!on and !pf.nomark) panes.File.pushUndo(p, pane);
+ if (!on and !pf.nomark) panes.File.pushUndo(p, pane) catch return Reply.fail(req.tag, E.NOMEM);
pf.nomark = !on;
},
.scroll => pf.noscroll = !on,