diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-26 09:41:38 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-26 10:16:37 -0300 |
| commit | 2dae98b564e677c24c5275070c413d05a85d12fc (patch) | |
| tree | 6a18f7ea935efdfca0b6f50229ca9eca6052741d /abi | |
| parent | 0fb10f2748bc1593b9c0dda0e74b53cb66a69a95 (diff) | |
| download | pardes-2dae98b564e677c24c5275070c413d05a85d12fc.tar.gz pardes-2dae98b564e677c24c5275070c413d05a85d12fc.zip | |
abi, Kind, pdf, fake: ABI 3.4, a kind's window holds the theme's search hit colours, `hit` and `hit_current` (Chrome's, read through p.chrome() as each pane of a kind is painted), and a PDF's search draws its hits in them, the current hit apart, where every hit was the literal amber #ffd54f (the colour line's leftover, themes DESIGN.md part F, L2e's row "PDF hits", B8's `PDF's ffd54f -> chrome.hit`: "current hit" had three colours, the body's, the rail's and the PDF's); THE ABI: pa_window gains `uint32_t hit, hit_current` at its end (24 to 32 bytes, the header's and Kind.zig's size checks), PA_ABI_MINOR 4; an addon reads them once `api->abi >= 0x30004`, so one built against 3.3 loads, opens and paints as before (the core refuses another major only, and reads nothing new of an addon), and one built against 3.4 under an older pardes is handed the amber its PDFs drew (abi/addon.zig's Window, filled by the glue); WHY THE WINDOW, NOT THE VIEW (pa_view, where fg, bg, sel and link are): a view's facts are a step's (`view` is on the tape, and a plain kind keeps them in its block: the pdf's Layout holds the whole pa_view), so two more colours there would grow the pdf's block, and an Upgrade's revival hands `load` the old block, whose size it would refuse, every open PDF a placeholder; the hits are drawn by paint alone, which writes nothing a step reads, and the window is made each paint; THE CORE: Kind.paint fills them, the theme colour's PA_RGB by Kind's one `rgb` (viewOf's, out of its function); THE PDF: paint hands its window to reconcile, and marksOf marks each hit of the page in `win.hit`, those of the current hit (`find.hit`, its quads) in `win.hit_current`, at the alpha they had; THE FAKE: paints `hits rrggbb rrggbb` on its fifth row (since 3.4), and is built once more with its head saying 3.3 (`fake_addon_old`, named fakeold); addons/fake/fake.out re-recorded (that row in each of its 11 frames, `hits 5e4923 917a53`, the addon test's theme; nothing else moved); docs/typ/reference.typ's paint says it; RUN (TEST FIRST): behaviour/addons.zig "addons: a kind's pane is painted with the theme's search hit colours, the current hit's apart (ABI 3.4), and a library whose head says 3.3 still loads, opens and paints": acme's `hits ffc790 a05200`, then neonotte84's `hits 4c301a e59d3c`, then fakeold listed `3.3 ... loaded` and its pane's `count 0`: with the header and the fake alone fails (the core's window `hits 000000 000000`), passes now; pdf.zig "a search's hits are marked in the theme's hit colours its window is painted with, the current hit in the current hit's (ABI 3.4)": a page's three quads, the second hit's two current: fails with the amber (expected 4c301a70, found ffd54f70), passes now; the ABI the addons say in /addons moves to 3.4 in five behaviour checks; a user saw every PDF hit amber in every theme and the current one no different; NEW HOT PATHS: per frame, per pane of a kind painted, two colours packed from the chrome (no allocation, no derivation: Chrome's resolved fields); none per key; GATES (the stack kysrwqpz, rqlxkzuq, this, Debug): core-test 1163/1338 (175 skipped: +1 skipped, the rerun test needs a terminal), shell-test 1379/1382 (3 skipped), pane-test 184/185, behaviour-test 288/288 (+1) and --replay 20 seeds of 70 steps, 0 failures, process-test 0 of 149 failed (3 skipped), term-test 17/17, kitty-test 45/45, addon-test 157/157 steps, 8/8 tests (fake.out, snake, pdf and their own tests); the soak with the pdf addon on this top found a second preview leak, pictures (the next change); the 40,000-seed dump fuzz crashed at join seed 8324 in draw.zig's Debug overlay (a General protection exception printing a string from a damaged dump), whose dumped session has no kind, no command pane and no window: these changes move none of its bytes (see the report); pdf-harness tui fails `KittyPdfBoundaryPageMissing` on M2 alike (8959b031dc33, run here), not this change's; no dump layout change (the window is made each paint); load 4.5 to 12.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'abi')
| -rw-r--r-- | abi/addon.zig | 12 | ||||
| -rw-r--r-- | abi/pardes_addon.h | 7 |
2 files changed, 14 insertions, 5 deletions
diff --git a/abi/addon.zig b/abi/addon.zig index 53227fbb..dfbac270 100644 --- a/abi/addon.zig +++ b/abi/addon.zig @@ -37,9 +37,9 @@ pub const c = @import("pardes_addon"); const Allocator = std.mem.Allocator; /// The ABI this file speaks: a header of another needs it brought along. -pub const abi = 0x30003; +pub const abi = 0x30004; comptime { - if (c.PA_ABI != abi) @compileError("addon.zig speaks ABI 3.3 and the header another"); + if (c.PA_ABI != abi) @compileError("addon.zig speaks ABI 3.4 and the header another"); } /// A word the kind brings: `opens` a pane of it, else goes to the pane's @@ -160,6 +160,10 @@ pub const Window = struct { /// The view painted (View.id), and whether it shows pictures as glyph art. view: u8, glyphs: bool, + /// The theme's search hits and the current one (a pardes older than + /// ABI 3.4: the amber its PDFs drew them in). + hit: Color, + hit_current: Color, /// `text` (UTF-8) from column x of row y on, a character a cell, cut at /// the edge: column first, where the header's pa_put is row first. @@ -315,7 +319,9 @@ pub fn ops(comptime T: type) c.pa_ops { if (@hasDecl(T, "prefix")) t.*.prefix_len = write(T.prefix, s, &t.*.prefix, t.*.prefix.len); } fn paint(st: ?*anyopaque, w: [*c]const c.pa_window, out: [*c]c.pa_paint) callconv(.c) void { - T.paint(self(st) orelse return, .{ .cells = w.*.cells, .stride = w.*.stride, .cols = w.*.cols, .rows = w.*.rows, .cell_w = w.*.cell_w, .cell_h = w.*.cell_h, .focused = w.*.focused != 0, .view = w.*.view, .glyphs = w.*.glyphs != 0 }, .{ .out = out }); + const amber: Color = .rgb(0xff, 0xd5, 0x4f); + const hits = api.abi >= 0x30004; + T.paint(self(st) orelse return, .{ .cells = w.*.cells, .stride = w.*.stride, .cols = w.*.cols, .rows = w.*.rows, .cell_w = w.*.cell_w, .cell_h = w.*.cell_h, .focused = w.*.focused != 0, .view = w.*.view, .glyphs = w.*.glyphs != 0, .hit = if (hits) @fromBackingInt(w.*.hit) else amber, .hit_current = if (hits) @fromBackingInt(w.*.hit_current) else amber }, .{ .out = out }); } fn view(st: ?*anyopaque, v: [*c]const c.pa_view) callconv(.c) void { T.view(self(st) orelse return, @as(*const View, @ptrCast(v)).*); diff --git a/abi/pardes_addon.h b/abi/pardes_addon.h index d8257a0b..e467a239 100644 --- a/abi/pardes_addon.h +++ b/abi/pardes_addon.h @@ -37,7 +37,7 @@ /* Major in the high half: an addon of another major is refused. */ #define PA_ABI_MAJOR 3u -#define PA_ABI_MINOR 3u +#define PA_ABI_MINOR 4u #define PA_ABI ((PA_ABI_MAJOR << 16) | PA_ABI_MINOR) #define PA_OK 0 #define PA_RASTER_MAX (32u << 20) /* a placement's w*h*4 above this is dropped, said once */ @@ -83,6 +83,9 @@ typedef struct pa_window { * `view`: the id of the view painted (pa_view's), whose layout paint * draws; `glyphs`: it shows pictures as glyph art. */ uint8_t focused, view, glyphs, pad; + /* Since 3.4 (check api->abi): the theme's search hits, and the current + * one, as the body draws them (PA_RGB). */ + uint32_t hit, hit_current; } pa_window; typedef struct pa_rect { uint32_t x, y, w, h; } pa_rect; /* pixels */ @@ -390,7 +393,7 @@ typedef struct pa_ops { * copy of this header that disagrees does not compile. */ #if UINTPTR_MAX == 0xffffffffffffffffu _Static_assert(sizeof(pa_cell) == 20, "pa_cell"); -_Static_assert(sizeof(pa_window) == 24, "pa_window"); +_Static_assert(sizeof(pa_window) == 32, "pa_window"); _Static_assert(sizeof(pa_rect) == 16 && sizeof(pa_cells) == 8, "pa_rect"); _Static_assert(sizeof(pa_placement) == 80, "pa_placement"); _Static_assert(sizeof(pa_paint) == 48 && sizeof(pa_view) == 32 && sizeof(pa_tick) == 128, "pa_paint"); |
