diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 05:15:35 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 05:18:09 -0300 |
| commit | b666f96e734bb87d6558c76c908314da562122d5 (patch) | |
| tree | 234ca0b2762b95673663d98448098954cdc1e29a /src/colors.zig | |
| parent | 6ec5935396f2a5584f464bb256de88c501ab6bf1 (diff) | |
| download | pardes-b666f96e734bb87d6558c76c908314da562122d5.tar.gz pardes-b666f96e734bb87d6558c76c908314da562122d5.zip | |
A Restore whose ThemeFile fails to load changes no theme: the session goes on showing the one it did, its file still the one named
A Restore makes a fresh core, which started at the default theme and
asked for the dump's ThemeFile; when that file had broken since, the
failure reverted to what the fresh core had loaded, nothing, and ink
became orchard. A Restore that asks for a ThemeFile now carries over
the theme the old session showed and the file it loaded (and its Theme,
unless the dump names one), so a failure there changes nothing.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/colors.zig')
| -rw-r--r-- | src/colors.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/colors.zig b/src/colors.zig index a45184c8..2dcb906a 100644 --- a/src/colors.zig +++ b/src/colors.zig @@ -837,6 +837,19 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo return true; } +/// A Restore's: the theme `old` showed, its loaded theme file's included, +/// for one that is to load a ThemeFile and keep this if it fails; +/// `index` too when the dump names no Theme. +pub fn carryTheme(p: *Pardes, old: *const Pardes, index: bool) !void { + if (index) p.settings.theme = old.settings.theme; + const t = old.custom_theme orelse return; + var copy = t; + copy.name = try p.gpa.dupe(u8, t.name); + if (p.custom_theme) |mine| std.zon.parse.free(p.gpa, mine); + p.custom_theme = copy; + _ = p.theme_file_loaded.set(old.theme_file_loaded.get()); +} + pub fn finishThemeInitialization(p: *Pardes) void { p.chrome_animation.snap(ChromeTheme.fromTheme(p.theme())); p.animate_theme_changes = true; |
