diff options
Diffstat (limited to 'src/host_io.zig')
| -rw-r--r-- | src/host_io.zig | 26 |
1 files changed, 10 insertions, 16 deletions
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; |
