summaryrefslogtreecommitdiff
path: root/core/panes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 18:20:56 -0300
committerGabriel Schneider <[email protected]>2026-11-23 23:34:56 -0300
commitcdab9ba0f0fdb433217f6b408ef81357176fa965 (patch)
tree7d01a9a74f524466e6e630596682d8dff5959797 /core/panes.zig
parentb1fb4242c0ab52767df1b8e155edcf2692f37873 (diff)
downloadpardes-cdab9ba0f0fdb433217f6b408ef81357176fa965.tar.gz
pardes-cdab9ba0f0fdb433217f6b408ef81357176fa965.zip
perf: a long wrapped line's row walks cut to the rows the view needs, each row's end found without a grapheme step, the top's byte handed to the geometry by the step that found it, the geometry's key hashed once a step (P62 round 3, item 2): perfops against tree6 from 11 of 121 over (item 1's tree: body-appends on longline +18.2%, client-key-down on longline +1.44%) to 10 (deep-sel's eight, the view drawing the selection deep in its 2 MB line; body-appends on longline's SETUP +0.66%, derived; client-key-down on longline +0.44%; terminal on all +0.12%, below the base's own ruled +0.14%), body-appends on longline per-op -7.4%, every key, wheel, page and edit cell at or under tree6; each cut found by Intel PT by symbol (`.scratch/sketch/reorg/pardes-row-scroll-3/pt-*.txt`): `fitEnd` ended every full row with a grapheme step to learn the next byte did not fit (~118 instructions a row): a full row before a printable ASCII byte that no non-ASCII byte follows now ends there, and the rest of a row of printable ASCII past the vector loop is one masked vector (both checked by the exhaustive fitEnd tests); `show` walks the cursor's line once and no further than it needs (`Bound`: `margin` rows past the cursor's and `body - 2 margin + 1` in all, its rows a lower bound then, which its walks never pass), keeping the first bytes of its last rows in a ring on the stack, and where the view lands in that line hands that byte to the geometry (`Pane.top_skip` gains the `key` of the geometry it is for: fillBody walks to the top's row only for a key no step found it for); a wheel's notch down off the map hands the map's byte the same way; `show` and `scrollRows` hash the geometry's key once (`topNow`, `shownNow`; ensureCursorVisible's extra `geometry` call gone) and a walk asks whether the map is fresh only when it reads a line off it; `rowsOf` walks a line with the walk's width (`rowWalked`), not through `rowIn`'s one-row check again; Debug in the workspace: core-test 963/1129 (166 skipped)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/panes.zig')
-rw-r--r--core/panes.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/panes.zig b/core/panes.zig
index b238992a..08d91df5 100644
--- a/core/panes.zig
+++ b/core/panes.zig
@@ -309,10 +309,11 @@ pub const Pane = struct {
wrap_n: u16 = 0,
/// A row map also exists for sticky headers when soft wrapping is off.
body_wrapped: bool = false,
- /// Where the geometry's walk found the view's top inside its line's
- /// rows (File.Top): the row it is and the bytes of the line before it;
- /// a frame's text starts there with no walk again.
- top_skip: struct { row: u32 = 0, at: usize = 0 } = .{},
+ /// Where the view's top is inside its line's rows (File.Top) for the
+ /// geometry of `key`: the row it is and the bytes of the line before
+ /// it, found by the geometry's walk or by the step that put the top
+ /// there; a frame's text starts there with no walk again.
+ top_skip: struct { key: u64 = 0, row: u32 = 0, at: usize = 0 } = .{},
context_rows: u16 = 0,
body_rows: u16 = 0,
body_visible_rows: u16 = 0,
@@ -668,7 +669,6 @@ pub const Pane = struct {
}
pub fn ensureCursorVisible(pane: *Pane, tab: u16) void {
- File.geometry(tab, pane);
if (pane.file != null) File.show(tab, pane, pane.body.cur_row, pane.body.cur_col, config.scroll_off) else {
// A terminal's rows are its lines.
const off = pane.scroll();