diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-06 06:24:42 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-06 11:19:44 -0300 |
| commit | c1917b949b9580de8bf0977874a210f0266812da (patch) | |
| tree | 447dd2235ea00634f662cd3becf4bceb8a895f41 /src/normal.zig | |
| parent | 76c55b5bce0f181b0b15b16596c900397dfef544 (diff) | |
| download | pardes-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/normal.zig')
| -rw-r--r-- | src/normal.zig | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/normal.zig b/src/normal.zig index d5ce5f4a..1fa5bf11 100644 --- a/src/normal.zig +++ b/src/normal.zig @@ -1,6 +1,6 @@ //! Helix normal mode: a key read against the configured bindings becomes //! modal actions, replayed across every selection, and each action is done -//! to the pane; PDF panes get their own normal keys. +//! to the pane (a kind's pane takes its own keys first, Kind.key). const pardes = @import("pardes.zig"); const tagline = @import("tagline.zig"); const exec = @import("exec.zig"); @@ -13,7 +13,6 @@ const panes = @import("panes.zig"); const edit = @import("edit.zig"); const config = @import("config.zig"); const keyboard = @import("keys.zig"); -const pdf_enabled = panes.Pdf.enabled; const Pane = panes.Pane; const Text = panes.Text; const Key = pardes.Key; @@ -852,7 +851,10 @@ fn executeNormalAction(p: *Pardes, t: *Text, a: modal.Normal.Action) void { return panes.startPrompt(p, pane, &pane.body, .{ .search = config.search_marker }), // In a file's text, n and N step its places while they answer for // the register (Places.answersN); else helix's search of the register. - .search_next, .search_prev => if (t.what == .body and pane.file != null and pane.places.answersN(p, pane)) + // A kind's pane walks its `/`'s +Search (look.zig runSearch). + .search_next, .search_prev => if (t.what == .body and pane.addon != null) + return look.lookWalk(p, if (a.role == .search_next) 1 else -1) + else if (t.what == .body and pane.file != null and pane.places.answersN(p, pane)) return pane.places.step(p, pane, a.role == .search_next, a.count, t.select) else return searchStep(p, t, text, a.role == .search_next, a.count), @@ -860,7 +862,7 @@ fn executeNormalAction(p: *Pardes, t: *Text, a: modal.Normal.Action) void { searchSelection(p, t, text, a.role == .search_selection_word); // The pattern is line 1 of this text's query pane, made or // reused, the keyboard staying here: n and N step its places. - if (t.what == .body and pane.file != null and !pane.hasPdf() and pane.query == null) { + if (t.what == .body and pane.file != null and pane.query == null) { const name = if (v.register != 0) v.register else '/'; const pat = p.registers.value(name, 0) orelse return; panes.Query.open(p, v.active, .text, pat, false); @@ -910,19 +912,6 @@ fn executeNormalAction(p: *Pardes, t: *Text, a: modal.Normal.Action) void { } } -pub fn handlePdfNormal(p: *Pardes, pane: *Pane, key: Key) void { - if (comptime !pdf_enabled) return; - if (pane.pdf == null) return; - if (pane.body.normal.prefix == null and isPrefix(key, 'f')) { - pane.body.normal.clear(); - return exec.runBuiltin(p, .PdfSections, p.view().active, "", null); - } - switch (modal.Normal.parse(&pane.body.normal, normalInput(key))) { - .pending, .ignored, .unbound => {}, - .action => |action| panes.Pdf.applyNormal(p, pane, action), - } -} - test "gj/gk step the wrapped rows a body draws while j/k keep the file's lines" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true }); |
