diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-26 10:19:20 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-26 11:28:39 -0300 |
| commit | add0837dc1927389096cbaaf65b7e1a42028eafc (patch) | |
| tree | cdf3252f64669691dd4d5338fc2019390d6d8131 /core/Core.zig | |
| parent | 7d0aaa0c1e68127c023358698498eaeffe57401b (diff) | |
| download | pardes-add0837dc1927389096cbaaf65b7e1a42028eafc.tar.gz pardes-add0837dc1927389096cbaaf65b7e1a42028eafc.zip | |
colors, Core, Kind, lib: the old views deleted, now that no surface reads them (DESIGN.md B6, B8): `ChromeTheme` (its old fields, `view` and `resolved`) and the old names' view of every theme (`viewOf`, theme_schema's `toLegacy` and `Derived`), `readingOf` (the reading tint, gone with G1'), `separatorOf`, `focusTint`/`focusTintFloor` and their floors, `lerp`, the sRGB `mix`, and `Grounds` (the library's diff grounds: `Chrome`'s `add` and `del` say them; lib_syntax exports `Chrome` in its place); `Pardes.theme()` is the theme worn in the new names (`*const Theme`: a picker's preview, a theme file's, or the session's), read for its name; `chromeTheme()` is gone and `chrome()` is the one accessor (the session's chrome or a preview's, each a `Chrome` worked out at a theme change); a theme file is kept as the `Theme` it loads to (`custom_theme`), its old names read by the load-time loader, which STAYS (`LegacyTheme` and `Theme.fromLegacy`: the user's own one_dark_zed_mod.zon and an older DumpThemes' output load as before); Kind's page, ink, selection and link for a picture's or a PDF's raster from the chrome (R1: the page, never the tag, as a theme's page where it has none: dark's `null_page`; the link the page's key ink), the macOS shell's rules and page from the chrome and the theme's `page`; the source test (body_layer.zig's: no `theme()` read but its name, no `chromeTheme()`, `.roles`, `Grounds` or `LegacyTheme`) covers draw.zig, tagline.zig, Band.zig, Messages.zig and Kind.zig too, so a surface deriving its own colour cannot be written there (B6's bar); THE TESTS: the tests of the old derivations go with them, each held by the ring test on the chrome (every native's separators and focus tint, every faithful port's own chrome, a legacy document's derived roles, the old active name-tint precedence), and the rest read the new names and the chrome (a theme's own rule kept, the natives' text and UI roles on their own surfaces, their dark palettes, the quiet line numbers through a theme file, the column grips, the ThemeFile load and its old-names loader, Core's, Command's, panes', terminal's, output's and file_watch's theme reads, the library consumer's diff grounds through `Chrome`); RUN: the build is the test of a deletion (no reader left), the suites below; GOLDENS: none moved; GATES on this change, the stack's top (tui): core-test 1158/1332 (174 skipped: the 4 tests of the old derivations gone; the importer's 7 counted again after a cache wipe), shell-test 1373/1376 (3 skipped), pane-test 184/185 (1 skipped), behaviour-test 287/287 and --replay 20 seeds of 70 steps, 0 failures, process-test 0 of 149 failed (3 skipped; 0 of 103 moved with --update), term-test 17/17, kitty-test 45/45; gui unit-test 1984/1988 (4 skipped; its one failure the known BaselineHarnessMismatch; test/consumer's diff grounds through `Chrome` pass); the ring 245 of 245; the dump fuzz at 40,000 join seeds twice and 1,779 image seeds 11/11 (custom_theme, a digested field, is a Theme now); the soak (replicas, 5 clients, rtt 30,80,207): diverged 0, unequal 0, quiet checks 365/0 451/0 622/0, unlisted stops 0, the corpus 22 of 22 scenes the same, no leak; load 1.3 to 15.6 (other agents' builds); OUTSIDE the L2a files: core/colors.zig, core/Core.zig, core/root.zig, core/theme_schema.zig, core/lib_syntax.zig, core/syntax.zig (a doc line), core/Kind.zig (two hunks), core/File.zig (a test line), core/body_layer.zig (the source test's list), runtime/macos.zig (three lines), dev/file_watch.zig, test/consumer/lib.zig, test/panes.zig, test/terminal.zig, test/output.zig, core/Command.zig (tests)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/Core.zig')
| -rw-r--r-- | core/Core.zig | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/core/Core.zig b/core/Core.zig index e727d27d..947fee4c 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -12,7 +12,6 @@ const BOX_H = pardes.BOX_H; const Builtin = pardes.Builtin; const COLBAR_H = pardes.COLBAR_H; const CellPixels = pardes.CellPixels; -const ChromeTheme = pardes.ChromeTheme; const Color = pardes.Color; const Effect = pardes.Effect; const Event = pardes.Event; @@ -47,7 +46,6 @@ const TAG_TEXT_INSET = pardes.TAG_TEXT_INSET; const TOPBAR_H = pardes.TOPBAR_H; const TagHit = pardes.TagHit; const Text = pardes.panes.Text; -const LegacyTheme = pardes.LegacyTheme; const builtins = pardes.builtins; const colors = pardes.colors; const column_weight_unit = layout.column_weight_unit; @@ -345,19 +343,19 @@ locations_config: locations.Config = .{}, locations_cache: locations.Cache = .{}, tty_filter_palette: pardes.Term.FilterPalette = .{}, font_request_taken: bool = false, -custom_theme: ?LegacyTheme = null, +custom_theme: ?colors.Theme = null, /// The theme the window wears while a picker of them (or `:theme `) /// previews one, by index, and its chrome (colors.previewTheme); the /// session's own theme untouched under it. theme_preview: ?u16 = null, -preview_chrome: ChromeTheme = undefined, +preview_chrome: colors.Chrome = undefined, theme_file_path: config.Settings.Text(limits.host_path_cap) = .{}, /// The ThemeFile last loaded whole: what /ctl and DumpConfig name, and /// what a failed ThemeFile goes back to (colors.revertThemeFile). theme_file_loaded: config.Settings.Text(limits.host_path_cap) = .{}, theme_file_generation: u32 = 0, theme_file_pane: Pane.Id = .at(0), -theme_chrome: colors.ChromeTheme = undefined, +theme_chrome: colors.Chrome = undefined, /// Every drawn frame's timings (FrameStats: the Debug box, PARDES_FRAMES): /// its runner's (`Options.frames`), which its frontend writes as it draws /// and reads input, never the core's memory; a core with no runner (a @@ -2173,23 +2171,20 @@ fn sizes(p: *const Pardes, pane: *const Pane) bool { return pane.sized_by == p.live; } -/// The theme in the old names, for what still reads a theme's own -/// fields (colors.ChromeTheme.view). -pub fn theme(p: *const Pardes) *const LegacyTheme { - if (p.theme_preview == null) if (p.custom_theme) |*custom| return custom; - return &p.chromeTheme().view; -} - -/// The colours of the chrome: the theme's, set as it changes. -pub fn chromeTheme(p: *const Pardes) *const ChromeTheme { - if (p.theme_preview != null) return &p.preview_chrome; - return &p.theme_chrome; +/// The theme the window wears: one a picker previews, a theme file's, or +/// the session's. Its name is what is read of it; a surface draws its +/// chrome (`chrome`). +pub fn theme(p: *const Pardes) *const colors.Theme { + if (p.theme_preview) |i| return &colors.themes[i]; + if (p.custom_theme) |*custom| return custom; + return &colors.themes[p.settings.theme]; } /// Every colour a surface draws (colors.Chrome), the theme's or the one a /// picker previews: worked out as the theme changes, never a frame. pub fn chrome(p: *const Pardes) *const colors.Chrome { - return &p.chromeTheme().resolved; + if (p.theme_preview != null) return &p.preview_chrome; + return &p.theme_chrome; } /// When the core next needs a frame, on the `stepped_ns` timeline: a @@ -2544,7 +2539,7 @@ test "startup config runs builtin lines in order and isolates bad lines" { try std.testing.expectEqualStrings("acme", p.theme().name); // The theme lands without a tween (the chrome is the theme's at once); // the bad lines are said, so a notice may be up. - try std.testing.expectEqual(ChromeTheme.fromTheme(p.theme()), p.chromeTheme().*); + try std.testing.expectEqual(colors.Chrome.of(p.theme()), p.chrome().*); try std.testing.expect(!p.quit); for (0..p.effects_len) |i| switch (p.effects[(p.effects_head + i) % p.effects.len]) { .write => |w| { @@ -3649,8 +3644,8 @@ test "startup config overrides restored styling before initFromDump returns" { try std.testing.expectEqualStrings("acme", restored.theme().name); try std.testing.expect(!source.animationActive()); try std.testing.expect(!restored.animationActive()); - try std.testing.expectEqual(ChromeTheme.fromTheme(source.theme()), source.chromeTheme().*); - try std.testing.expectEqual(ChromeTheme.fromTheme(restored.theme()), restored.chromeTheme().*); + try std.testing.expectEqual(colors.Chrome.of(source.theme()), source.chrome().*); + try std.testing.expectEqual(colors.Chrome.of(restored.theme()), restored.chrome().*); } test "restored terminals keep monotonic nonzero pane identities" { @@ -3743,7 +3738,7 @@ test "tabbed file aligns syntax cursor and mouse at the nearest insertion gap" { const text_x = rect.x + config.GUTTER + config.PREFIX_W; const body_y = rect.y + BOX_H; // The keyword's ink shows the glyph boundaries. - const kw: Color = .{ .rgb = p.theme().kw }; + const kw: Color = .{ .rgb = p.theme().keyword }; for (0..config.tab_width) |col| try std.testing.expect(!std.meta.eql(kw, surface.at(text_x + @as(u16, @intCast(col)), body_y).style.fg)); for (0.."return".len) |col| |
