diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-25 05:52:41 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 05:52:41 -0300 |
| commit | 18043e845b39ac63dfe4416787e5cf6476ce8434 (patch) | |
| tree | 0b28a690a5c671046b30498188e1567c164ccc88 /core/panes.zig | |
| parent | c22b57e13fec318ff4df96fb07b096ea53e31122 (diff) | |
| download | pardes-18043e845b39ac63dfe4416787e5cf6476ce8434.tar.gz pardes-18043e845b39ac63dfe4416787e5cf6476ce8434.zip | |
syntax, body_layer, panes, normal, root, Names, Pick: `]`'s painted targets in one query pass, kept while nothing moves, and Find's first key sorting only the rows it shows (walk UI P3 item 4, POLISH 19, F's and D's reports): (a) body_layer.targetLine ran the grammar's textobject query three times a frame while `]` or `[` showed (syntax.objectNext once each for function, comment, test); NOW syntax.objectNext finds any number of objects in one pass of the query (`objects`, `out`; the motion's one-object call in normal.zig unchanged in effect) and body_layer.treeTargets asks it once for the three, keeping the lines on the pane (Pane.targets, derived: never digested or dumped) while the text's revision, the caret's byte, the lines shown and the way stay, so a frame that paints them again asks nothing; paintTargets' drawing is untouched; (b) Names.rescore sorted every hit at every call (std.sort.pdq over 50,000 paths for a first key); NOW the best `reach` hits (`max_rows`, 200: what a query pane lists; a picker's cursor gone past them sorts further, Names.reachTo from Pick.key, and C-q's keep sorts its 2,000) are kept as a heap of the best so far and sorted, the rest after them in no order (O(n log k)); (c) the picker's preview read is left on the loop: measured, a 2,000-line file's tick and frame is 2.36M instructions, 285-531 us, under a twentieth of a 60 Hz frame (a read from a slow mount would still block it: not moved, said in the report); MEASURED (pardes-perf ReleaseFast tui, the same tree before and after this change): `]` painted, tick + frame, longest 11,066,602 instr (802 us) -> 4,677,637 (368 us, the frame that asks; the cached ones about the at-rest frame's 0.89M); pick key + frame (50,000 paths, first key) 58,751,637 (4,383 us) -> 41,394,164 (2,416 us, the rest is the scorer's); pick Down + frame 1,358,803 -> 1,356,960; pick preview tick + frame 2,357,436 -> 2,365,116; TESTS: core/Names.zig "Names keeps its best `reach` hits first in a full sort's order, the rest after them, and sorts further as a cursor goes past them"; the painted targets' and the motions' own tests unchanged; root.zig names Pane.targets among the kept-out fields; core-test 1064/1234 (170 skipped), behaviour-test 280/280
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/panes.zig')
| -rw-r--r-- | core/panes.zig | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/panes.zig b/core/panes.zig index 20a03b25..c984a73e 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -26,13 +26,17 @@ const effect_path_cap = pardes.effect_path_cap; /// Files use row zero; terminal overlays may begin anywhere in scrollback. pub const EditText = struct { text: []u8, row0: i32 }; +/// What a pane's `]` and `[` tree targets were found for (Pane.targets): +/// its text's revision, the caret's byte, the lines shown, the way. +pub const TargetsKey = struct { revision: u32, at: usize, lo: usize, hi: usize, forward: bool }; + pub const Pane = struct { /// What the replay digest leaves out (core/walk.zig): the view's geometry, /// made again from the rest (File.geometry); the other views' share of /// it (views.zig). (The 9P server's part of `fs` says so in its type.) pub const replica = .{ .local = .{ "pv", "pv_known" }, - .derived = .{ "band_rows", "ghost_at", "ghost_rows", "wrap_line", "wrap_col", "wrap_pad", "wrap_n", "body_wrapped", "context_rows", "body_rows", "body_visible_rows", "context_row_limit", "geometry_key", "geometry_len", "top_skip", "notices", "pan" }, + .derived = .{ "band_rows", "ghost_at", "ghost_rows", "wrap_line", "wrap_col", "wrap_pad", "wrap_n", "body_wrapped", "context_rows", "body_rows", "body_visible_rows", "context_row_limit", "geometry_key", "geometry_len", "top_skip", "notices", "pan", "targets" }, .len = .{ .{ "question", "question_len" }, .{ "shell_tail", "shell_tail_len" }, .{ "sel_snap", "nsel_snap" } }, // A picture's memory is its own allocator's (a dump loaded makes // it there). @@ -367,6 +371,9 @@ pub const Pane = struct { /// `ghost_at` (its line's last), the rows below drawn that many lower. /// The mouse reads it, so that a click lands on what is drawn under it. ghost_at: u16 = 0, + /// `]`'s and `[`'s tree targets as the body drawn last found them + /// (body_layer.treeTargets), and what for. + targets: struct { key: ?TargetsKey = null, lines: [3]?usize = @splat(null) } = .{}, ghost_rows: u16 = 0, /// Each other view's share of this pane, while it is not live /// (views.zig): its cursor, scroll and place in that view's layout. |
