From c1917b949b9580de8bf0977874a210f0266812da Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 06:24:42 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/host_io.zig | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src/host_io.zig') diff --git a/src/host_io.zig b/src/host_io.zig index 9cc34465..44061c4d 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -167,24 +167,18 @@ pub fn testClock() ?u64 { return if (libc.getenv("PARDES_TEST_CLOCK")) |v| (if (std.mem.span(v).len != 0) 0 else null) else null; } -/// The image, PDF and syntax subsystems a frontend's session draws with, -/// on `allocs` (pardes.memory.init); PDF pages render on lanes off the -/// loop (pdf_view.workers). `stopWorkers` is its defer. +/// The kitty images and syntax subsystems a frontend's session draws with, +/// on `allocs` (pardes.memory.init), and what kinds keep past a call (their +/// heap, `pa_api.heap`: the pdf addon's documents and pages). `stopWorkers` +/// is its defer. pub fn startWorkers(io: std.Io, allocs: pardes.memory.Allocators) void { - if (comptime pardes.pdf_enabled) { - pardes.TerminalImages.start(io, allocs.image); - pardes.pdf.start(allocs.pdf); - pardes.panes.Pdf.workers = io; - } + pardes.TerminalImages.start(io, allocs.image); + pardes.Kind.heap = allocs.addon; pardes.syntax.start(allocs.tree_sitter); } pub fn stopWorkers() void { - if (comptime pardes.pdf_enabled) { - pardes.TerminalImages.stop(); - pardes.panes.Pdf.dropKept(); - pardes.pdf.stop(); - } + pardes.TerminalImages.stop(); pardes.syntax.stop(); } @@ -2152,10 +2146,10 @@ pub const exec_command_max = pardes.exec.command_max; /// graphics by the pixels (yazi's previews; pardes nested in a pane). pub fn ptyWinsize(core: ?*const pardes.Pardes, cols: u16, rows: u16) posix.winsize { var ws: posix.winsize = .{ .row = rows, .col = cols, .xpixel = 0, .ypixel = 0 }; - if (comptime pardes.pdf_enabled) if (core) |c| { + if (core) |c| { ws.xpixel = std.math.cast(u16, @as(u32, cols) * c.view().cell_pixels.w) orelse 0; ws.ypixel = std.math.cast(u16, @as(u32, rows) * c.view().cell_pixels.h) orelse 0; - }; + } return ws; } @@ -3597,7 +3591,7 @@ pub fn writeFile(core: *pardes.Pardes, watches: *file_watch.Table, pane: u8, pat if (core.panes[pane]) |pn| if (pn.file) |f| if (std.mem.eql(u8, f.path, path)) { if (watches[pane]) |*w| if (w.serial == pn.serial) switch (w.generation) { .text => w.generation = .{ .text = std.hash.Wyhash.hash(0, bytes) }, - .pdf => {}, + .kind => {}, }; }; var mbuf: [256]u8 = undefined; -- cgit v1.3