From bac1c62c1905a5ce11a6b630d556bc349041628b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 13:30:42 -0300 Subject: An image's or a terminal's tag says petscii:on when it is drawn as glyph art, as it always is with no graphics; Petscii on|off still chooses for when there are The images and tagbottomimage goldens are re-recorded for the word. Co-Authored-By: Claude Opus 5.5 --- src/tagline.zig | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/tagline.zig') diff --git a/src/tagline.zig b/src/tagline.zig index 5a9e2346..a1ce437d 100644 --- a/src/tagline.zig +++ b/src/tagline.zig @@ -94,10 +94,11 @@ fn shownDir(arena: std.mem.Allocator, pane: *Pane) ![]const u8 { /// The computed start of a pane's tag -- its path and dirty marker, a /// PDF's page, a terminal's directory -- without the space that parts it /// from the tag's own text. It is never stored, and never edited. -pub fn pathPrefix(arena: std.mem.Allocator, pane: *Pane) ![]const u8 { +pub fn pathPrefix(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]const u8 { if (comptime pdf_enabled) if (pane.pdf) |pv| return std.fmt.allocPrint(arena, "{s} [{d}/{d}]", .{ pv.path, pv.page + 1, pv.page_count }); - if (pane.image) |*state| return panes.Image.tagPrefix(arena, state); + // What is drawn: with no graphics, glyph art whatever `Petscii` says. + if (pane.image) |*state| return panes.Image.tagPrefix(arena, state, state.glyph_art or !p.native_images); // A command pane: its directory, the line it runs, and how that went. // Its first line only, cut to 48 bytes at a character's start: a tag's // first row is where the prefix ends, and a line that ran over to a @@ -127,18 +128,21 @@ pub fn pathPrefix(arena: std.mem.Allocator, pane: *Pane) ![]const u8 { if (pane.file) |f| return if (pane.prompt == .name) pane.input.own orelse f.path else f.path; // A terminal showing kitty graphics says how it draws them, as an image // pane does, and so does one drawing them as glyph art by choice. - if (panes.terminal.petscii(pane)) |on| if (on or panes.terminal.hasImages(pane)) - return std.fmt.allocPrint(arena, "{s} petscii:{s}", .{ (try shownDir(arena, pane)), if (on) "on" else "off" }); + if (panes.terminal.petscii(pane)) |chosen| { + const on = chosen or !p.native_images; + if (chosen or panes.terminal.hasImages(pane)) + return std.fmt.allocPrint(arena, "{s} petscii:{s}", .{ (try shownDir(arena, pane)), if (on) "on" else "off" }); + } return (try shownDir(arena, pane)); } pub fn tagPrefix(p: *Pardes, pane: *Pane) ![]u8 { - return prefixIn(p.scratch.allocator(), pane); + return prefixIn(p, p.scratch.allocator(), pane); } /// The prefix as the tag shows it, built in `arena`. -pub fn prefixIn(arena: std.mem.Allocator, pane: *Pane) ![]u8 { - const prefix = try pathPrefix(arena, pane); +pub fn prefixIn(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]u8 { + const prefix = try pathPrefix(p, arena, pane); // The space between the prefix and the tag's own text is the text's // (every default starts with one), but the prefix is computed, so it // cannot trust the text to keep it: with it deleted, Look and Exec -- cgit v1.3