summaryrefslogtreecommitdiff
path: root/src/keys.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/keys.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/keys.zig')
-rw-r--r--src/keys.zig8
1 files changed, 4 insertions, 4 deletions
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.