From ac450e5868f528b312abb2b46191cd8bce5bff3d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 25 Nov 2026 00:46:11 -0300 Subject: Command: once a `:` command takes its argument the rows are what it takes, the rest of the line the query, and `:theme ` dresses the whole window in the current row (walk UI, pick-ui SPEC.md §8, item 2 of line E2): `theme ` lists every theme (colors.themes, in the ring's order, `in use` beside the session's), `set ` and `toggle ` the settings this frontend has with their values now (the root ctl's text, ninep/ctl.zig settingsText), `set Wrap ` that setting's words (Settings.choices: `on off`, `walk new-pane`, `off cat frog`; `now` beside the one it has), `open ` the recent files (recent.zig, 200 at most, from the pane's directory, `open` beside a file a pane shows: the directory walk is the pickers' and not in this tree), `pipe ` the pipe history, newest first; filtered as the names are (Names.match, in their order), counted (`273 themes · the window wears the current one`, `2 values`, `1 recent file`), Tab and S-Tab writing the row after the command (`set Wrap off`); THE PREVIEW: colors.wear(p, index) is the one function a state that previews themes calls (agent F's Themes picker can call it as it is): the live view's TagState.worn (an index of colors.themes, in the digest and the dump, held to the themes on a load: replica `.index` isTheme) and every pane flagged previewing, so none dims; Core.theme() returns the worn theme and chromeTheme() its chrome, worked out once a theme (Pardes.worn_chrome, a cache kept out as body_chrome is, made by wear and by a frame's first step for a view that wears another), nothing loaded or set: every pane, tag and band recolours on the next frame; TagState.toRest takes it off, so Esc puts the window's own back, and Enter runs `Theme `; a load meanwhile works out the session's own chrome (colors.finishThemeInitialization no longer reads theme()); TagState.max_hits is at least the themes' count (273: 70 of pardes's, 203 generated) so their rows fit; test/perf.zig --search measures a key in `:` and Tab in `:theme ` with their frames; TEST FIRST: Command.zig ":theme lists the themes and the whole window wears the current one, none dimmed; Tab steps it on, Esc puts the window's own back, Enter keeps the one worn; :set lists the settings with their values, then a setting's values; :pipe the pipes typed last; :open the recent files"; item 1's test reads the theme worn for `:theme acme`; core-test 1022/1189 (167 skipped) Co-Authored-By: Claude Opus 5.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/Core.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core/Core.zig') diff --git a/core/Core.zig b/core/Core.zig index 61d8c7e9..a16940e3 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -345,6 +345,8 @@ font_request_taken: bool = false, custom_theme: ?Theme = null, /// bodyChrome's: the theme it was worked out for, and it. body_chrome: ?struct { theme: Theme, chrome: ChromeTheme } = null, +/// The chrome of the theme a view wears (colors.wear): its index, and it. +worn_chrome: ?struct { index: u16, chrome: ChromeTheme } = null, 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). @@ -531,7 +533,7 @@ pub const replica = .{ "opts", "dump_out", "dump_export", "tape", }, - .derived = .{ "shell_rows", "diff_output", "locations_cache", "retired_panes", "tty_filter_palette", "body_chrome" }, + .derived = .{ "shell_rows", "diff_output", "locations_cache", "retired_panes", "tty_filter_palette", "body_chrome", "worn_chrome" }, // The host's handles, the state file every session of the user // shares (and Recent read from it), this session's closed panes, and // the files of a host with no file system of its own. (The 9P @@ -2137,12 +2139,15 @@ fn sizes(p: *const Pardes, pane: *const Pane) bool { } pub fn theme(p: *const Pardes) *const Theme { + // A theme the live view wears while it previews one (colors.wear). + if (p.views[p.live]) |*v| if (v.tag_state.worn) |i| return &themes[i]; if (p.custom_theme) |*custom| return custom; return &themes[p.settings.theme]; } /// The colours of the chrome: the theme's, set as it changes. pub fn chromeTheme(p: *const Pardes) *const ChromeTheme { + if (p.views[p.live]) |*v| if (v.tag_state.worn) |i| if (p.worn_chrome) |*w| if (w.index == i) return &w.chrome; return &p.chrome; } -- cgit v1.3