diff options
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index fb6aa4cf..f51409aa 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -43,12 +43,16 @@ pub const PaneKind = enum { terminal, pdf, image, + /// An image pane, or a terminal, whose program's kitty graphics are + /// pictures too. + picture, pub fn has(kind: PaneKind, pane: *const panes.Pane) bool { return switch (kind) { .terminal => pane.isTerminal(), .pdf => pane.hasPdf(), .image => pane.image != null, + .picture => pane.image != null or pane.isTerminal(), }; } @@ -57,6 +61,7 @@ pub const PaneKind = enum { .terminal => "a terminal", .pdf => "a PDF", .image => "an image", + .picture => "an image or a terminal", }; } }; @@ -981,11 +986,13 @@ pub const PdfSections = struct { } }; -/// glyph art over the host's pixels +/// glyph art over the host's pixels: an image pane's picture, or the +/// kitty graphics a terminal's program placed (yazi's previews) pub const Petscii = struct { - pub const needs: PaneKind = .image; + pub const needs: PaneKind = .picture; pub fn run(c: Ctx) void { if (c.pane.image) |*state| panes.Image.toggleGlyphArt(state); + panes.terminal.togglePetscii(c.pane); } }; |
