summaryrefslogtreecommitdiff
path: root/src/Term.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 00:41:26 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commit191d0eca0ba25b94ce2b466cc11b879e7553473a (patch)
tree3f1c9d40eff76e16a2085dc5e72d7628928a423f /src/Term.zig
parent26929e67111e843db4ad27abb4f1341cf396158c (diff)
downloadpardes-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/Term.zig')
-rw-r--r--src/Term.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Term.zig b/src/Term.zig
index 160ed01e..6c9bd4e3 100644
--- a/src/Term.zig
+++ b/src/Term.zig
@@ -7,6 +7,7 @@
//! the one place Phase 1 turns into the module's registration).
const std = @import("std");
const terminal = @import("term/terminal.zig");
+const pager = @import("term/pager.zig");
/// A terminal pane's emulator, its parse and what pardes keeps beside it.
pub const State = terminal.State;
@@ -195,3 +196,18 @@ pub const Rows = struct {
text: []const u8,
rows: [][]const u8,
};
+
+// ---- the pager ----
+
+/// A program's output, as a terminal reads it, paged (`pardes -`, a
+/// /pager write): its printed text and its SGR colours as spans over it
+/// (`Page`), every other control dropped. The emulator's own parse, so a
+/// +Pager pages what a terminal pane would print.
+pub const page = pager.parse;
+pub const Page = pager.Page;
+/// Bytes `start..end` of a page's text, drawn in `style`.
+pub const Span = pager.Span;
+
+test {
+ _ = pager;
+}