diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-06 00:02:06 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-06 01:21:34 -0300 |
| commit | 423440f25b4b23b56162008bba35218d438767fe (patch) | |
| tree | a7b06a88c7a55308e7e906ff49fa264a1fd147cf /src/builtins.zig | |
| parent | 94ca47f225632fefc8f688c0c0822d25d6a5db1e (diff) | |
| download | pardes-423440f25b4b23b56162008bba35218d438767fe.tar.gz pardes-423440f25b4b23b56162008bba35218d438767fe.zip | |
kinds #2, a pane of a kind is one slot and image is a kind compiled in: src/kinds/pardes_addon.h is the kinds' C ABI (the cell, the window a kind paints, placements and the tag prefix it hands back, keys, the mouse, pa_api of six functions over the pane's arena, words, the head and pa_ops of paint and sixteen optional functions), translated once by the build into the core's records, never mirrored; src/Kind.zig is the core's side: the kinds this process has (a registry with the checks a load makes: the head's size and abi major, a paint, a name, words, leaders and extensions none else has), a pane's Slot (the kind's state and arena, its path, the art bytes Petscii, Palette and Ascii set, its tick deadline and jobs) and the addon arm at the sites: Look and the initial file by extension, draw (cells into the grid, placements keyed by serial and the kind's key), the tag prefix from a paint over no cells, nextWake and the step (ticks, jobs' answers landing on the loop), close, Recent, paneDir, /index's kind word; a dump writes a slot by hand (kind name and version, path, where, art, the kind's own record) and loads it through the kind's open and load, or as a placeholder that keeps the record when the kind is not here; image.zig's pane is now a static pa_ops (open refuses what it cannot read, the decode a job whose answer lands at a step instead of a thread polled by draw, one placement fitted by the frontend, its record the file's bytes), Pane.image is Pane.addon, and the three art words act on the slot; no golden changes (images.snap and tagbottomimage.snap pass, the tag prefix and the placement key are the same bytes); tests: the image dump test, the Petscii/Palette/Ascii ctl tests, the image tag-prefix test and fs_namespace's decode test rewritten on the slot (the decode now lands at the step after the open), plus a registry test; gates: core-test 960/960 on both, unit-test 1487/1488 tui and 1531/1532 gui, behaviour-test 244/244, pane-test 171/172, snap all ok, process-test 0 of 37 failed on both
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 4c6fc367..92df2645 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -73,8 +73,8 @@ pub const PaneKind = enum { return switch (kind) { .terminal => pane.isTerminal(), .pdf => pane.hasPdf(), - .image => pane.image != null, - .picture => pane.image != null or pane.isTerminal(), + .image => pane.addon != null, + .picture => pane.addon != null or pane.isTerminal(), .program_colors => pane.isTerminal() or (pane.file != null and pane.file.?.pager), .diff => if (pane.file) |f| pane.colorAlgo() == .diff or (f.output != null and std.meta.eql(f.output.?.from, panes.Output.Origin{ .cmd = .Diff })) else false, @@ -996,12 +996,12 @@ pub const Petscii = struct { pub const takes_arg = true; pub fn run(c: Ctx) void { // `on|off` sets it, as the tag's `petscii:on` reads; none flips it. - const now = if (c.pane.image) |state| state.glyph_art else panes.terminal.petscii(c.pane) orelse false; + const now = if (c.pane.addon) |k| k.art.glyph else panes.terminal.petscii(c.pane) orelse false; if (c.arg != null) { const want = stateArg(c, OnOff, "Petscii", "on or off") orelse return; if ((want == .on) == now) return; } - if (c.pane.image) |*state| state.glyph_art = !state.glyph_art; + if (c.pane.addon) |k| k.art.glyph = !k.art.glyph; panes.terminal.togglePetscii(c.pane); } }; @@ -1011,12 +1011,12 @@ pub const Palette = struct { pub const needs: PaneKind = .image; pub const takes_arg = true; pub fn run(c: Ctx) void { - const state = &(c.pane.image orelse return); + const art = &(c.pane.addon orelse return).art; if (c.arg != null) { const want = stateArg(c, panes.Image.PaletteMode, "Palette", "commodore or terminal") orelse return; - if (want == state.pmode) return; + if (want == art.palette) return; } - state.pmode = if (state.pmode == .commodore) .terminal else .commodore; + art.palette = if (art.palette == .commodore) .terminal else .commodore; } }; @@ -1025,12 +1025,12 @@ pub const Ascii = struct { pub const needs: PaneKind = .image; pub const takes_arg = true; pub fn run(c: Ctx) void { - const state = &(c.pane.image orelse return); + const art = &(c.pane.addon orelse return).art; if (c.arg != null) { const want = stateArg(c, OnOff, "Ascii", "on or off") orelse return; - if ((want == .on) == state.ascii) return; + if ((want == .on) == art.ascii) return; } - state.ascii = !state.ascii; + art.ascii = !art.ascii; } }; |
