summaryrefslogtreecommitdiff
path: root/src/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/panes.zig')
-rw-r--r--src/panes.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/panes.zig b/src/panes.zig
index c4a32413..9f1ce036 100644
--- a/src/panes.zig
+++ b/src/panes.zig
@@ -37,7 +37,7 @@ pub const Pane = struct {
.len = .{ .{ "msg", "msg_len" }, .{ "msg_older", "msg_older_len" }, .{ "question", "question_len" }, .{ "shell_tail", "shell_tail_len" }, .{ "sel_snap", "nsel_snap" } },
// A picture's and a PDF's memory is their own allocators' (a dump
// loaded makes it there).
- .alloc = .{ .{ "image", "image" }, .{ "pdf", "pdf" }, .{ "terminal", "terminal" } },
+ .alloc = .{ .{ "addon", "image" }, .{ "pdf", "pdf" }, .{ "terminal", "terminal" } },
};
/// The words that throw unsaved text away (builtins.zig warnModified).
pub const Discarding = enum { Exit, Restore, get, Del, Delcol };
@@ -201,7 +201,8 @@ pub const Pane = struct {
/// (builtins.zig warnModified).
discard_warned: ?struct { revision: u32, by: Discarding } = null,
file: ?File.State = null,
- image: ?Image.State = null,
+ /// A pane of a kind (Kind.zig): a picture, or one a library brought.
+ addon: ?*@import("Kind.zig").Slot = null,
pdf: PdfSlot = if (Pdf.enabled) null else {},
prompt: Prompt = .none,
/// The text an open prompt answers for: `s`/`S` select in it and `|`
@@ -502,7 +503,7 @@ pub const Pane = struct {
pub fn isTerminal(pane: *const Pane) bool {
const no_pdf = if (comptime Pdf.enabled) pane.pdf == null else true;
- return pane.file == null and pane.image == null and no_pdf;
+ return pane.file == null and pane.addon == null and no_pdf;
}
/// The one coloring choice keyed on what a pane IS, so the highlight
@@ -736,6 +737,7 @@ test {
_ = Dir;
_ = mini;
_ = Image;
+ _ = @import("Kind.zig");
_ = Pdf;
_ = terminal;
}
@@ -803,9 +805,7 @@ pub fn teardownPane(p: *Pardes, pane: *Pane) void {
panes.terminal.deinitPendingCommand(pane);
if (pane.command) |line| p.gpa.free(line);
if (pane.shell) |bin| p.gpa.free(bin);
- if (pane.image) |*iv| {
- iv.deinit(p.image_gpa);
- }
+ @import("Kind.zig").close(p, pane);
if (comptime pdf_enabled) if (pane.pdf) |pv| panes.Pdf.deinitPane(p, pane, pv);
if (pane.file) |*file| panes.File.deinit(p, pane, file);
if (pane.ovl) |o| p.gpa.free(o.text);
@@ -1000,7 +1000,7 @@ pub fn paneDir(pane: *const Pane) []const u8 {
if (pane.file) |f| return panes.Dir.ofName(f.path);
if (comptime pdf_enabled) if (pane.pdf) |pv|
return std.fs.path.dirname(pv.path) orelse "/";
- if (pane.image) |iv| return std.fs.path.dirname(iv.path) orelse "/";
+ if (pane.addon) |k| if (k.path.len > 0) return std.fs.path.dirname(k.path) orelse "/";
return pane.cwdSlice();
}