summaryrefslogtreecommitdiff
path: root/core/Kind.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Kind.zig')
-rw-r--r--core/Kind.zig24
1 files changed, 12 insertions, 12 deletions
diff --git a/core/Kind.zig b/core/Kind.zig
index cf684a55..459ed6d8 100644
--- a/core/Kind.zig
+++ b/core/Kind.zig
@@ -399,12 +399,7 @@ pub fn fileChanged(p: *Pardes, id: usize, _: []const u8) bool {
const record = @import("dump.zig").slotRecord(s) catch null;
var place: [32]u8 = undefined;
s.where_text.set(where(s, &place));
- if (s.ops) |o| if (o.close) |f| {
- var cl: Call = .{ .p = null, .id = 0, .slot = s, .quiet = true };
- const prev = cl.begin("close");
- f(s.st);
- _ = cl.end(prev);
- };
+ shut(s);
s.st = null;
s.arena.deinit();
s.arena = .init(s.gpa);
@@ -434,18 +429,23 @@ pub fn close(p: *Pardes, pane: *Pane) void {
};
if (ready.items.len == 0) ready.clearAndFree(heap);
}
- if (s.ops) |ops| if (ops.close) |f| if (!kept) {
- var cl: Call = .{ .p = null, .id = 0, .slot = s, .quiet = true };
- const prev = cl.begin("close");
- f(s.st);
- _ = cl.end(prev);
- };
+ if (!kept) shut(s);
const gpa = s.gpa;
s.free();
gpa.destroy(s);
pane.addon = null;
}
+/// The kind's own close of what its open made (`s.st`), quiet.
+pub fn shut(s: *Slot) void {
+ const ops = s.ops orelse return;
+ const f = ops.close orelse return;
+ var cl: Call = .{ .p = null, .id = 0, .slot = s, .quiet = true };
+ const prev = cl.begin("close");
+ f(s.st);
+ _ = cl.end(prev);
+}
+
/// The pane's body painted over the `cols` x `rows` cells at (x, y):
/// its cells into `s`, its placements after the frame's others. A pane
/// whose kind has no code here, or a placeholder, says why in a line.