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/keys.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/keys.zig') diff --git a/src/keys.zig b/src/keys.zig index ee14a48a..e6b417a9 100644 --- a/src/keys.zig +++ b/src/keys.zig @@ -228,11 +228,12 @@ pub fn handleKey(p: *Pardes, key: Key) void { return panes.terminal.forwardKey(p, p.view().active, key); } // A kind's pane that takes keys takes them all, as a raw terminal - // does, but Esc, which leaves (and Shift-Esc, above). + // does; Esc too, first, when its kind is of 2.1 (a PDF's drops its + // search), and not taken it leaves (and Shift-Esc, above, at once). if (header == null and pane.focus == .body and pane.prompt == .none) if (pane.addon) |slot| if (pardes.Kind.takesKeys(p, slot)) { p.view().prefix = .none; - if (key.cp == Key.escape and !key.ctrl and !key.alt) return exec.runBuiltin(p, .Last, p.view().active, "", null); if (pardes.Kind.key(p, p.view().active, key)) return; + if (key.cp == Key.escape and !key.ctrl and !key.alt) return exec.runBuiltin(p, .Last, p.view().active, "", null); }; if (p.view().prefix == .leader) return leaderKey(p, key); if (p.view().prefix == .window) { @@ -367,7 +368,7 @@ pub fn handleKey(p: *Pardes, key: Key) void { return; } edit.pinPaneCursor(p, &pane.body); - const explicit = (p.view().frontend.native_images and pane.hasPdfSelection()) or + const explicit = (if (pane.addon) |k| k.selection.len > 0 else false) or (pane.body.vsel.active and pane.body.vsel.explicit); if (explicit) { if (exec.chordEachSel(p, pane, cmd)) return; @@ -386,7 +387,6 @@ pub fn handleKey(p: *Pardes, key: Key) void { mouse.dispatchPointerBuiltin(p, p.view().active, cmd, operand.text, .{ .on_tag = false, .operand = operand }); return; } - if (t.mode == .normal and t.what == .body and pane.hasPdf()) return normal.handlePdfNormal(p, pane, key); if (t.what == .tag and t.mode == .insert and tagline.typedIntoName(p, pane, key)) return; // A tag's prefix is read-only: a key whose edit reached into it // changes nothing, not even where the cursor is. -- cgit v1.3