diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 00:41:26 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 191d0eca0ba25b94ce2b466cc11b879e7553473a (patch) | |
| tree | 3f1c9d40eff76e16a2085dc5e72d7628928a423f /src/File.zig | |
| parent | 26929e67111e843db4ad27abb4f1341cf396158c (diff) | |
| download | pardes-191d0eca0ba25b94ce2b466cc11b879e7553473a.tar.gz pardes-191d0eca0ba25b94ce2b466cc11b879e7553473a.zip | |
pager: one parser, the terminal's: a +Pager's page is read through the interface (Term.page, bytes in, its printed text and SGR spans out, Term.Page and Term.Span plain records), by ghostty-vt's stream as before kqrzvrmm, the handler that keeps the text, the spans and the overstrike moving with it to src/term/pager.zig; pager.zig's own parser (its ECMA-48 states, CSI limits and SGR reading) and src/pager.zig go, so two parsers cannot drift apart, and its tests stay with the page (the colon colours, 8-bit CSI, REP, CHT and CNL test kept, true by construction now); a 32 MiB coloured log pages in 2,074M instructions through the interface against 2,292M with the parser it replaces (ReleaseFast, a bench run once then removed; the same text and spans); Term.zig's tests take term/pager.zig's in; the changelog says the pager's own parser no more; pagercolor and every golden unchanged
Diffstat (limited to 'src/File.zig')
| -rw-r--r-- | src/File.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/File.zig b/src/File.zig index 962737d4..336b8526 100644 --- a/src/File.zig +++ b/src/File.zig @@ -128,11 +128,11 @@ pub const State = struct { /// A +Pager whose text is a diff (`git diff`, `show`, `log -p`): drawn /// and looked at as a diff (Pane.colorAlgo). pager_diff: bool = false, - /// A +Pager's colours, as its program printed them (pager.zig): drawn + /// A +Pager's colours, as its program printed them (Term.page): drawn /// over its text by recolorSyntax, never read over 9P. ponytail: any /// edit drops them (setContentSpan); shifting them through the splice, /// as pane.zig's shiftOne moves dot, would keep them. - pager_spans: []pardes.pager.Span = &.{}, + pager_spans: []pardes.Term.Span = &.{}, /// Seconds of the last content change, for the filesystem's stat; zero until edited. mtime: u32 = 0, /// Non-null for a generated output buffer rather than an on-disk file. @@ -1955,11 +1955,11 @@ pub fn recolorSyntax(p: *Pardes, s: *Surface, pane: *Pane, f: *State, r: pardes. const whole = highlights[base - highlight_start] & syntax.diff_whole != 0; if (row_tint or whole) s.tint(tx + @as(u16, @intCast(prefix_width)), body_y + vr, tw -| @as(u16, @intCast(prefix_width)), if (row_tint) t.bg else t.line_bg, null); }; - // A +Pager's own colours (pager.zig) on every row but one the diff + // A +Pager's own colours (Term.page) on every row but one the diff // look tints: an added or removed line is drawn as pardes draws a // diff, and git's red and green on it would only fight the tint. - var span_at = if (tint != null) spans.len else std.sort.partitionPoint(pardes.pager.Span, spans, base + hs, struct { - fn before(at: usize, span: pardes.pager.Span) bool { + var span_at = if (tint != null) spans.len else std.sort.partitionPoint(pardes.Term.Span, spans, base + hs, struct { + fn before(at: usize, span: pardes.Term.Span) bool { return span.end <= at; } }.before); |
