summaryrefslogtreecommitdiff
path: root/src/draw.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/draw.zig')
-rw-r--r--src/draw.zig22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/draw.zig b/src/draw.zig
index b63f61d8..4c476914 100644
--- a/src/draw.zig
+++ b/src/draw.zig
@@ -68,7 +68,7 @@ pub fn place(p: *Pardes, s: *Surface) void {
var rail: Region = .{ .kind = .rail, .owner = owner, .serial = pane.serial, .active = active, .rect = .{ .x = r.x, .y = body_y, .w = config.GUTTER, .h = body_h } };
// An image's rail has no thumb; a native PDF's is measured as its
// pages are placed (Pdf.draw); every other pane's is here.
- if (pane.image == null and body_h > 0) {
+ if (pane.addon == null and body_h > 0) {
const sb: struct { total: usize, offset: usize, len: usize } = if (pane.file) |*f| .{
.total = panes.File.nlines(p.gpa, f),
.offset = f.scroll,
@@ -91,7 +91,7 @@ pub fn place(p: *Pardes, s: *Surface) void {
rail.thumb_span = @as(f32, @floatFromInt(@max(1, sb.len))) / @as(f32, @floatFromInt(total));
}
s.addRegion(rail);
- if (body_h > 0 and pane.image == null) pane.places.addTicks(p, pane, s, owner);
+ if (body_h > 0 and pane.addon == null) pane.places.addTicks(p, pane, s, owner);
// Each notice a chip at the right edge, one to a row in the order
// collectNotices chose, as wide as its own message and no wider, so
// the text beneath the rest of the row keeps reading as the file.
@@ -436,13 +436,13 @@ fn renderPane(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r:
if (comptime pdf_enabled)
if (pane.hasPdf() and panes.Pdf.draw(p, s, pane, r, id, tx, tw, rail)) return;
- if (pane.image) |*iv| {
+ if (pane.addon != null) {
// Below the notice chips: a picture is drawn after the cells (the
// GUI's image pass, kitty's z-order), so a chip over it would be
- // painted out. Text gets the overlay; a picture gives up the rows.
+ // painted out. Text gets the overlay; a kind's pane gives up the rows.
const shown = pane.notices.span();
- const image_h = (r.h -| pane.tag_rows) -| shown;
- panes.Image.draw(p, iv, @intCast(id), pane.serial, tx, body_y + shown, tw, image_h);
+ const body_h = (r.h -| pane.tag_rows) -| shown;
+ pardes.Kind.draw(p, s, arena, pane, id, tx, body_y + shown, tw, body_h);
// thumbless, but the same one column as the real scrollbar below —
// that is the whole point of drawing it, and like that one it runs
// past the notice bands so the gutter has no notch in it
@@ -557,10 +557,12 @@ fn tagTintRange(pane: *const Pane, tag: []const u8, prefix_len: usize) ?struct {
var start: usize = 0;
const name = if (pane.file) |file|
if (pane.prompt == .name) pane.input.own orelse file.path else file.path
- else if (pane.image) |state| blk: {
- // Image tags put renderer controls before the path.
- start = std.mem.lastIndexOf(u8, tag[0..@min(prefix_len, tag.len)], state.path) orelse return null;
- break :blk state.path;
+ else if (pane.addon) |k| blk: {
+ // A kind's tag may put its words before the path (an image's
+ // renderer controls).
+ if (k.path.len == 0) return null;
+ start = std.mem.lastIndexOf(u8, tag[0..@min(prefix_len, tag.len)], k.path) orelse return null;
+ break :blk k.path;
} else if (comptime pdf_enabled) blk: {
break :blk if (pane.pdf) |state| state.path else return null;
} else return null;