summaryrefslogtreecommitdiff
path: root/src/tagline.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 06:24:42 -0300
committerGabriel Schneider <[email protected]>2026-11-06 11:19:44 -0300
commitc1917b949b9580de8bf0977874a210f0266812da (patch)
tree447dd2235ea00634f662cd3becf4bceb8a895f41 /src/tagline.zig
parent76c55b5bce0f181b0b15b16596c900397dfef544 (diff)
downloadpardes-c1917b949b9580de8bf0977874a210f0266812da.tar.gz
pardes-c1917b949b9580de8bf0977874a210f0266812da.zip
kinds #14, the core's PDF code gone: pdf.zig and pdf_view.zig leave and every pdf_enabled branch with them; look, Jump, Recent, dumps (one from before the addon opens as its pane), the watch, mouse, keys, the rail and the tag go through Kind for any kind's pane; test/pdf.zig's behaviours are T1 cases over 9P (addons_pdf.zig) and pane cases (a Shadow over a replica, a file changed under it), the harnesses load pdf.so by path
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/tagline.zig')
-rw-r--r--src/tagline.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tagline.zig b/src/tagline.zig
index 469d97d1..28cd2a9b 100644
--- a/src/tagline.zig
+++ b/src/tagline.zig
@@ -9,7 +9,6 @@ const panes = @import("panes.zig");
const edit = @import("edit.zig");
const exec = @import("exec.zig");
const config = @import("config.zig");
-const pdf_enabled = panes.Pdf.enabled;
const Layer = @import("Layer.zig");
const layout = @import("layout.zig");
const Pane = panes.Pane;
@@ -18,7 +17,6 @@ const TAG_TEXT_INSET = pardes.TAG_TEXT_INSET;
const Pardes = pardes.Pardes;
pub const pane_tail = " " ++ config.pane_builtins_str;
-pub const pdf_pane_tail = " " ++ config.pdf_pane_builtins_str;
pub const file_pane_tail = " " ++ config.file_pane_builtins_str;
fn withFileCommands(comptime tail: []const u8, comptime words: []const u8) []const u8 {
std.debug.assert(std.mem.endsWith(u8, tail, " Del"));
@@ -116,8 +114,6 @@ fn shownDir(arena: std.mem.Allocator, pane: *Pane) ![]const u8 {
/// 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(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 });
// What is drawn: with no graphics, glyph art whatever `Petscii` says.
if (pane.addon != null) return pardes.Kind.prefix(p, arena, pane);
// A command pane: its directory, the line it runs, and how that went.
@@ -185,7 +181,8 @@ pub fn curTail(pane: *Pane) []const u8 {
}
pub fn defaultTail(pane: *const Pane) []const u8 {
- if (comptime pdf_enabled) if (pane.pdf != null) return pdf_pane_tail;
+ // A kind's: Term, its words for its panes, Collapse Del (Kind.open).
+ if (pane.addon) |k| if (k.tail.len > 0) return k.tail.slice();
if (pane.query) |q| return if (q.frozen) query_frozen_tail else if (q.capped) query_capped_tail else query_live_tail;
if (pane.file) |file| if (file.output) |out| if (out.from == .preview) return query_live_tail;
if (pane.file) |file| if (file.listing != null) return dir_pane_tail;
@@ -293,8 +290,11 @@ pub fn wrapTag(arena: std.mem.Allocator, whole: []const u8, width: usize) !Shown
if (!first) try out.append(arena, '\n');
first = false;
var rest = line;
- while (panes.File.displayWidth(rest) > w) {
- var cut = modal.graphemeStart(rest, panes.File.rawAtDisplay(rest, w));
+ // The grapheme at column w, if the row runs past it: a row's
+ // measure, never the whole rest's (this runs on every step).
+ while (true) {
+ var cut = panes.File.byteAtDisplay(rest, w);
+ if (cut >= rest.len) break;
if (cut == 0) cut = modal.nextGrapheme(rest, 0);
try out.appendSlice(arena, rest[0..cut]);
try soft.append(arena, out.items.len);