diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 13:45:25 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | a2e466a874502b665807f620eb8edefb37be1e8c (patch) | |
| tree | 25aa244348932914e3a112c76652176da2e364a4 /src/file_watch.zig | |
| parent | a945c035ce9e3d5fda81a05f95f3ea1788a19ece (diff) | |
| download | pardes-a2e466a874502b665807f620eb8edefb37be1e8c.tar.gz pardes-a2e466a874502b665807f620eb8edefb37be1e8c.zip | |
A ThemeFile that cannot be read or is no theme fails its write, and a bad path says why
The theme is read when the host performs the request, after the write had been answered, so a missing file or a bad theme only showed a message; and a path not ending .zon said only invalid theme path. Load failures are now the waiting write's (late, as a Save's), and the path refusal says a theme file is a .zon.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/file_watch.zig')
| -rw-r--r-- | src/file_watch.zig | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/file_watch.zig b/src/file_watch.zig index 81f4ba87..148bc836 100644 --- a/src/file_watch.zig +++ b/src/file_watch.zig @@ -576,12 +576,19 @@ pub fn applyThemeEffect( watchPath(fd, watches, theme_slot, null, 0, .{ .text = 0 }); if (!on) return false; const request = colors.themeFileRequest(core, generation) orelse return false; + // What fails here is the ThemeFile write's failure too, which waits on + // this (the one-failure rule): late, as a Save's. + const pane = request.pane; const bytes = filesystem.readFile(gpa, request.path) catch |err| { colors.failThemeFile(core, generation, err); + core.noteLateFailure(pane); return false; }; defer gpa.free(bytes); - if (!colors.loadThemeFile(core, generation, bytes, animate)) return false; + if (!colors.loadThemeFile(core, generation, bytes, animate)) { + core.noteLateFailure(pane); + return false; + } const hash = std.hash.Wyhash.hash(0, bytes); watchPath(fd, watches, theme_slot, request.path, generation, .{ .text = hash }); if (watches[theme_slot] == null) return false; |
