summaryrefslogtreecommitdiff
path: root/src/gui
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/gui
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/gui')
-rw-r--r--src/gui/gui.zig61
1 files changed, 19 insertions, 42 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index 1125ff03..e7cd539a 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -482,20 +482,16 @@ fn updateCoreResize(core: *pardes.Pardes, cols: u16, rows: u16, cell_w: u32, cel
fn resizeOf(v: *const pardes.Pardes.View, cols: u16, rows: u16, cell_w: u32, cell_h: u32, tag_w: u32, tag_h: u32) ?pardes.Event {
const metrics: pardes.RowMetrics = .{ .body_w = @intCast(cell_w), .body_h = @intCast(cell_h), .tagline_w = @intCast(tag_w), .tagline_h = @intCast(tag_h) };
const same_metrics = std.meta.eql(metrics, v.row_metrics);
- if (comptime pardes.pdf_enabled) {
- const cell_px_w: u16 = @intCast(@min(@max(1, cell_w), std.math.maxInt(u16)));
- const cell_px_h: u16 = @intCast(@min(@max(1, cell_h), std.math.maxInt(u16)));
- if (cols == v.screen_w and rows == v.screen_h and
- cell_px_w == v.cell_pixels.w and cell_px_h == v.cell_pixels.h and same_metrics) return null;
- return .{ .resize = .{
- .cols = cols,
- .rows = rows,
- .cell_pixels = .{ .w = cell_px_w, .h = cell_px_h },
- .row_metrics = metrics,
- } };
- }
- if (cols == v.screen_w and rows == v.screen_h and same_metrics) return null;
- return .{ .resize = .{ .cols = cols, .rows = rows, .row_metrics = metrics } };
+ const cell_px_w: u16 = @intCast(@min(@max(1, cell_w), std.math.maxInt(u16)));
+ const cell_px_h: u16 = @intCast(@min(@max(1, cell_h), std.math.maxInt(u16)));
+ if (cols == v.screen_w and rows == v.screen_h and
+ cell_px_w == v.cell_pixels.w and cell_px_h == v.cell_pixels.h and same_metrics) return null;
+ return .{ .resize = .{
+ .cols = cols,
+ .rows = rows,
+ .cell_pixels = .{ .w = cell_px_w, .h = cell_px_h },
+ .row_metrics = metrics,
+ } };
}
const TouchPoint = struct {
@@ -1697,7 +1693,6 @@ fn localSession(
var opts = opts_in;
opts.addons = pardes.Addon.scan();
opts.image_allocator = allocs.image;
- opts.pdf_allocator = allocs.pdf;
opts.tree_sitter_allocator = allocs.tree_sitter;
opts.frame_allocator = allocs.frame;
var pw: c_int = 0;
@@ -2030,21 +2025,15 @@ fn remoteSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_
const have: ?*replica.Have = if (far) &have_store else null;
const allocs = pardes.memory.init(gpa);
defer pardes.memory.deinit();
- if (comptime pardes.pdf_enabled) {
- pardes.TerminalImages.start(io, allocs.image);
- pardes.pdf.start(allocs.pdf);
- }
+ pardes.TerminalImages.start(io, allocs.image);
+ pardes.Kind.heap = allocs.addon;
pardes.syntax.start(allocs.tree_sitter);
defer {
- if (comptime pardes.pdf_enabled) {
- pardes.TerminalImages.stop();
- pardes.pdf.stop();
- }
+ pardes.TerminalImages.stop();
pardes.syntax.stop();
}
var o = opts_in;
o.image_allocator = allocs.image;
- o.pdf_allocator = allocs.pdf;
var joined: replica.Joined = undefined;
var r = replica.join(gpa, &joined, to.path, to.session, o, have, &why, null) orelse Said.no(io, "{s}", .{std.mem.sliceTo(&why, 0)});
@@ -2910,22 +2899,12 @@ fn wheelAt(g: *Gui, in: *Input, w: WheelTurn, mc: MouseCell) void {
resetScroll(g);
};
if (hit) |id| {
- const pdf_target = if (comptime pardes.pdf_enabled)
- core.view().frontend.native_images and core.panes[id].?.pdfPage() != null
- else
- false;
const pane = core.panes[id].?;
- if (pdf_target) {
- resetScroll(g);
- in.post(.{ .pdf_scroll = .{
- .pane = @intCast(id),
- .delta_pixels = -w.y * @as(f32, @floatFromInt(g.cell_h)),
- .glide = notchOf(w.y, w.integer_y) != null,
- } });
- } else if (!w.mods.shift and pane.isTerminal() and pardes.panes.terminal.ownsWheel(pane)) {
- // The program's (codex, htop, less): every whole
- // turn goes to it, no glide, for nothing of ours
- // moves. Shift keeps the wheel pardes's.
+ if (pane.addon != null or (!w.mods.shift and pane.isTerminal() and pardes.panes.terminal.ownsWheel(pane))) {
+ // The program's (codex, htop, less), or a kind's (a
+ // PDF's strip): every whole turn goes to it, no glide,
+ // for nothing of ours moves. Shift keeps a terminal's
+ // wheel pardes's.
resetScroll(g);
g.program_wheel = accumulateWheelDelta(g.program_wheel, w.y);
while (g.program_wheel >= 1) : (g.program_wheel -= 1)
@@ -5314,9 +5293,7 @@ fn renderFrame(
const caret_alpha: f32 = if (gliding) 0.85 + 0.15 * std.math.clamp(1 - g.caret.remaining(now) / 0.5, 0, 1) else 1;
g.cursor_quad_alpha = if (quad_mode) caret_alpha * blink_alpha else 0;
// The probe's view of this frame's motion (FrameStats.Frame).
- // A focused PDF's strip is the core's (pdf_view.draw).
- const pdf_focus = if (core.panes[core.view().active]) |pane| pane.hasPdf() else false;
- if (!pdf_focus) core.frames.scroll = g.glide.follow.offset;
+ core.frames.scroll = g.glide.follow.offset;
core.frames.caret = caretRow(g, surface, now) orelse 0;
const cursors_shown = !quad_mode;
var overlay_count = buildOverlay(g, core.settings.pet, core.settings.jump_trail, surface, now, sw, sh);