Skip to content

config: a theme that fails to load says nothing, because the overlay swap frees the diagnostic #761

Description

@deblasis

A theme name that does not resolve produces no message anywhere. The terminal
comes up on the compile-time colours and nothing says why.

Seen with theme = Catppuccin Mocha on Windows: the terminal rendered
#282C34 rather than the theme, with no diagnostic in the log, no notice in
the UI, and no indication in the settings window.

Why nothing surfaces

themepkg.open appends "failed to load theme from the path X" to
self._diagnostics (src/config/Config.zig). loadTheme then goes through
the overlay, which builds a fresh config with cloneEmpty, copies the replay
steps onto it, and swaps: self.deinit() frees the old diagnostics list and
self.* = new_config installs one that started empty. The message is written
and then thrown away a few lines later.

Upstream has the same shape, so this is worth fixing there rather than only
here. What makes it more visible in this fork is that there are now two paths
through that swap.

Also worth settling

Whether the bundled themes are reachable on the Windows search path at all.
Location.resources joins resourcesDir().app() with themes, and if that
directory is not present in a Windows build then every bundled theme name
fails to resolve and this bug is what hides it. That is a separate question
from the diagnostics being dropped, but the two together are why a valid
theme name silently does nothing.

Suggested shape

Carry _diagnostics across the swap the way the replay steps are carried, or
re-emit after it. Then confirm a bad theme name reaches the log and the
settings window's diagnostics list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions