diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 13:28:13 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 15:23:49 -0300 |
| commit | 23c9932afe9bbf01aa84d780e9030dfb6e333475 (patch) | |
| tree | 01f801fe4e9f286cc44eb8ad206ed4ab8585ab77 /src | |
| parent | 1b2ac091200e9192f3677abe161217ba82463606 (diff) | |
| download | pardes-23c9932afe9bbf01aa84d780e9030dfb6e333475.tar.gz pardes-23c9932afe9bbf01aa84d780e9030dfb6e333475.zip | |
effects out, the theme crossfade: a theme change takes the chrome at once, as it always took the content; colors.ChromeAnimation (its OKLab steps, its retarget, the ticks and the frames it asked of nextWake) goes, Pardes.chrome is the theme's chrome, set as the theme changes, and the `animate` flag goes from loadThemeFile and applyThemeEffect with it, as does the build's -Dtheme-animation option (and its place in the wire's fingerprint); no frontend fades a theme of its own (a window crossfading every cell's colour for 160 ms is a copy of the last frame kept and blended, for one keystroke's change); the fade's tests go, the PDF test loses its ticks through a fade, and `core animation keeps wall time at 60, 120 and 144 Hz and across a stall` goes with the one animation that ran it; the perf baselines lose the option from their build identity; GUI goldens 16-debug and 17-terminal change, the golden session having faded its themes by default: a fade's frames kept the Debug word's announcement up in the picture's pane, which gave up a row to it under the Debug box; the tree before this change built with -Dtheme-animation=false draws exactly these frames, all sixteen byte for byte
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src')
| -rw-r--r-- | src/colors.zig | 195 | ||||
| -rw-r--r-- | src/draw.zig | 3 | ||||
| -rw-r--r-- | src/file_watch.zig | 8 | ||||
| -rw-r--r-- | src/gui/gui.zig | 1 | ||||
| -rw-r--r-- | src/host_io.zig | 2 | ||||
| -rw-r--r-- | src/ninep/ctl.zig | 8 | ||||
| -rw-r--r-- | src/pardes.zig | 52 | ||||
| -rw-r--r-- | src/tui/tui.zig | 2 | ||||
| -rw-r--r-- | src/wire.zig | 7 |
9 files changed, 23 insertions, 255 deletions
diff --git a/src/colors.zig b/src/colors.zig index aec2917f..f09bf9db 100644 --- a/src/colors.zig +++ b/src/colors.zig @@ -1,16 +1,14 @@ //! Colour themes: the Theme type, the curated and generated ring, chrome -//! colours and their animation, theme files, and switching themes at runtime. +//! colours, theme files, and switching themes at runtime. const pardes = @import("pardes.zig"); const tagline = @import("tagline.zig"); const panes = @import("panes.zig"); const std = @import("std"); -const animation = @import("animation.zig"); const Color = @import("surface.zig").Color; const FontRole = @import("surface.zig").FontRole; const config = @import("config.zig"); const pdf_enabled = panes.Pdf.enabled; const platform = pardes.platform; -const theme_animation = @import("pardes_config").theme_animation; const MAX_PANES = pardes.MAX_PANES; const BOX_H = pardes.BOX_H; const Pardes = pardes.Pardes; @@ -601,55 +599,6 @@ pub const ChromeTheme = struct { } }; -/// The chrome as it is drawn: the theme's, fading from the last one over -/// `animation.transition_steps` frames, each colour through OKLab (G10: a -/// fade keeps its lightness even, never going muddy or dark between two -/// hues as a mix of sRGB bytes does). A change eases in and out (§8.1); one -/// set off partway through another eases out, moving at once, so it never -/// stalls (§7.2). A build without theme_animation snaps instead -/// (finishThemeInitialization). -pub const ChromeAnimation = struct { - from: ChromeTheme, - to: ChromeTheme, - displayed: ChromeTheme, - step: u16 = animation.transition_steps, - retargeted: bool = false, - - pub fn init(chrome: ChromeTheme) ChromeAnimation { - return .{ .from = chrome, .to = chrome, .displayed = chrome }; - } - - pub fn isActive(a: *const ChromeAnimation) bool { - return a.step < animation.transition_steps; - } - - pub fn retarget(a: *ChromeAnimation, target: ChromeTheme) void { - a.retargeted = a.isActive(); - a.from = a.displayed; - a.to = target; - a.step = if (std.meta.eql(a.from, target)) animation.transition_steps else 0; - if (a.step == animation.transition_steps) a.displayed = target; - } - - pub fn advance(a: *ChromeAnimation) void { - if (!a.isActive()) return; - a.step += 1; - if (a.step == animation.transition_steps) { - a.displayed = a.to; - return; - } - const t = @as(f32, @floatFromInt(a.step)) / @as(f32, @floatFromInt(animation.transition_steps)); - // In thousandths of the way, as the fade has always stepped. - const k = @round(animation.sample(if (a.retargeted) .out_cubic else .smooth, t) * 1000); - inline for (@typeInfo(ChromeTheme).@"struct".field_names) |name| - @field(a.displayed, name) = if (k == 0) @field(a.from, name) else if (k >= 1000) @field(a.to, name) else mixOklab(@field(a.from, name), @field(a.to, name), k / 1000); - } - - pub fn snap(a: *ChromeAnimation, chrome: ChromeTheme) void { - a.* = init(chrome); - } -}; - pub const initial_chrome = ChromeTheme.fromTheme(&themes[0]); fn nextThemeFileGeneration(p: *Pardes) u32 { @@ -743,7 +692,7 @@ fn revertThemeFile(p: *Pardes) void { p.emit(.{ .theme_file = .{ .generation = generation, .on = loaded.len > 0 } }); } -pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bool) bool { +pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8) bool { // ZON's generated field dispatch grows with the complete theme schema. @setEvalBranchQuota(10000); const request = themeFileRequest(p, generation) orelse return false; @@ -777,11 +726,7 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo return false; }; - const target_chrome = ChromeTheme.fromTheme(&parsed); - if (animate and p.animate_theme_changes) - p.chrome_animation.retarget(target_chrome) - else - p.chrome_animation.snap(target_chrome); + p.chrome = ChromeTheme.fromTheme(&parsed); const old = p.custom_theme; p.custom_theme = parsed; if (old) |theme_value| p.gpa.free(theme_value.name); @@ -793,8 +738,7 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo } pub fn finishThemeInitialization(p: *Pardes) void { - p.chrome_animation.snap(ChromeTheme.fromTheme(p.theme())); - p.animate_theme_changes = theme_animation; + p.chrome = ChromeTheme.fromTheme(p.theme()); } fn invalidateThemeDependentRasters(p: *Pardes) void { @@ -885,11 +829,7 @@ pub fn setThemeIndex(p: *Pardes, index: usize) void { if (index >= themes.len or (p.custom_theme == null and p.theme_file_path.get().len == 0 and index == @as(usize, p.settings.theme))) return; - const target_chrome = ChromeTheme.fromTheme(&themes[index]); - if (p.animate_theme_changes) - p.chrome_animation.retarget(target_chrome) - else - p.chrome_animation.snap(target_chrome); + p.chrome = ChromeTheme.fromTheme(&themes[index]); if (p.custom_theme) |theme_value| { p.custom_theme = null; p.gpa.free(theme_value.name); @@ -938,13 +878,13 @@ test "ThemeFile parses ZON atomically and Theme returns to the compiled ring" { var encoded: std.Io.Writer.Allocating = .init(std.testing.allocator); defer encoded.deinit(); try std.zon.stringify.serialize(custom, .{ .whitespace = true }, &encoded.writer); - try std.testing.expect(loadThemeFile(p, request_effect.generation, encoded.written(), false)); + try std.testing.expect(loadThemeFile(p, request_effect.generation, encoded.written())); try std.testing.expectEqualStrings("mine", p.theme().name); try std.testing.expectEqual(@as(?[3]u8, .{ 1, 2, 3 }), p.theme().bg); try std.testing.expectEqual(ChromeTheme.fromTheme(p.theme()), p.chromeTheme().*); // A half-written save is rejected without disturbing the last good value. - try std.testing.expect(!loadThemeFile(p, request_effect.generation, ".{ .name = ", true)); + try std.testing.expect(!loadThemeFile(p, request_effect.generation, ".{ .name = ")); // Said with its line, in words: never a bare `parse zon`. const said = p.panes[0].?.msg[0..p.panes[0].?.msg_len]; try std.testing.expect(std.mem.indexOf(u8, said, ": line 1: ") != null and std.mem.indexOf(u8, said, "parse zon") == null); @@ -961,127 +901,6 @@ test "ThemeFile parses ZON atomically and Theme returns to the compiled ring" { try std.testing.expect(!stop.on); } -test "runtime theme changes animate chrome and retarget without a jump" { - const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); - defer p.deinit(); - const first = p.chromeTheme().*; - try std.testing.expect(!p.animationActive()); - - const dark_index = for (themes, 0..) |th, i| { - if (std.mem.eql(u8, th.name, "dark")) break i; - } else return error.MissingDarkTheme; - const acme_index = for (themes, 0..) |th, i| { - if (std.mem.eql(u8, th.name, "acme")) break i; - } else return error.MissingAcmeTheme; - - setThemeIndex(p, dark_index); - // Target semantics are immediate, while the displayed chrome begins at - // the exact previous frame. - try std.testing.expectEqualStrings("dark", p.theme().name); - try std.testing.expectEqual(first, p.chromeTheme().*); - try std.testing.expect(p.animationActive()); - p.update(.tick); - p.update(.tick); - p.update(.tick); - const midflight = p.chromeTheme().*; - try std.testing.expect(!std.meta.eql(first, midflight)); - - setThemeIndex(p, acme_index); - try std.testing.expectEqualStrings("acme", p.theme().name); - try std.testing.expectEqual(midflight, p.chromeTheme().*); - try std.testing.expect(p.animationActive()); - for (0..animation.transition_steps) |_| p.update(.tick); - try std.testing.expect(!p.animationActive()); - try std.testing.expectEqual(ChromeTheme.fromTheme(p.theme()), p.chromeTheme().*); - // Extra ticks are inert at the exact endpoint. - p.update(.tick); - try std.testing.expectEqual(ChromeTheme.fromTheme(p.theme()), p.chromeTheme().*); -} - -/// A chrome of one colour everywhere, for the fade's tests. -fn chromeOf(rgb: [3]u8) ChromeTheme { - var out: ChromeTheme = undefined; - inline for (@typeInfo(ChromeTheme).@"struct".field_names) |name| @field(out, name) = rgb; - return out; -} - -test "a chrome fade starts where it is, lands exactly with every channel on its way, and goes no further" { - const from = chromeOf(.{ 240, 240, 240 }); - const to = chromeOf(.{ 5, 5, 5 }); - var fade: ChromeAnimation = .init(from); - fade.retarget(to); - try std.testing.expectEqual(from, fade.displayed); - var previous = fade.displayed.tag_bg; - for (0..animation.transition_steps) |_| { - fade.advance(); - for (fade.displayed.tag_bg, previous) |now, was| try std.testing.expect(now <= was); - previous = fade.displayed.tag_bg; - } - try std.testing.expect(!fade.isActive()); - try std.testing.expectEqual(to, fade.displayed); - fade.advance(); - try std.testing.expectEqual(to, fade.displayed); -} - -test "a chrome fade retargeted partway sets off from what is shown" { - const first = chromeOf(.{ 0, 40, 200 }); - const second = chromeOf(.{ 200, 140, 0 }); - const third = chromeOf(.{ 20, 10, 250 }); - var fade: ChromeAnimation = .init(first); - fade.retarget(second); - for (0..3) |_| fade.advance(); - const on_screen = fade.displayed; - fade.retarget(third); - try std.testing.expectEqual(on_screen, fade.from); - try std.testing.expectEqual(on_screen, fade.displayed); - try std.testing.expect(fade.isActive()); - for (0..animation.transition_steps) |_| fade.advance(); - try std.testing.expectEqual(third, fade.displayed); -} - -test "render uses target content colors while chrome is in flight" { - const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 12 }); - defer p.deinit(); - const source_chrome = p.chromeTheme().*; - const acme_index = for (themes, 0..) |th, i| { - if (std.mem.eql(u8, th.name, "acme")) break i; - } else return error.MissingAcmeTheme; - setThemeIndex(p, acme_index); - - var frame = std.heap.ArenaAllocator.init(std.testing.allocator); - defer frame.deinit(); - const surface = try p.render(frame.allocator()); - // The anchored topbar has not advanced from its source frame. - try std.testing.expectEqual( - Color{ .rgb = source_chrome.tag_bg }, - surface.at(0, 0).style.bg, - ); - const topbar_cell = surface.at(@import("pardes.zig").TAG_TEXT_INSET, 0); - try std.testing.expect(!std.mem.eql(u8, topbar_cell.grapheme(), " ")); - try std.testing.expectEqual(FontRole.tagline, topbar_cell.style.font_role); - const r = p.rects[0]; - const tag_cell = find_tag_cell: { - var x = r.x + config.GUTTER; - while (x < r.x + r.w) : (x += 1) { - const cell = surface.at(x, r.y); - if (!std.mem.eql(u8, cell.grapheme(), " ")) break :find_tag_cell cell; - } - return error.MissingTagText; - }; - try std.testing.expectEqual(FontRole.tagline, tag_cell.style.font_role); - try std.testing.expectEqual(FontRole.tagline, surface.at(r.x, r.y).style.font_role); - try std.testing.expectEqual(FontRole.tagline, surface.at(r.x + r.w - 1, r.y).style.font_role); - // The document/terminal page does not ride the chrome animation: acme's - // target background is already present in the same render. - const body = surface.at(r.x + r.w - 1, r.y + r.h - 1); - try std.testing.expectEqual(FontRole.body, body.style.font_role); - try std.testing.expectEqual( - Color{ .rgb = p.theme().bg.? }, - body.style.bg, - ); - try std.testing.expect(p.animationActive()); -} - test "native themes keep text and UI roles readable on their own surfaces" { const names = [_][]const u8{ "orchard", "dusk", "ink", "paper", "daybreak", "atelier", "forge", "lagoon", "solarium", "spectrum", "harvest", "clay", "forge_black", "forge_soft", "orchard_black" }; try std.testing.expectEqual(names.len, native_theme_count); diff --git a/src/draw.zig b/src/draw.zig index 55fab141..9db5d0ff 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -1086,7 +1086,6 @@ test "an unfocused grip shows on its tag in the grid, in every native theme" { defer p.deinit(); _ = try p.setTestFile("text\n"); p.newScratchBelow(0); - p.animate_theme_changes = false; var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); for (pardes.themes[0..colors.native_count], 0..) |theme, index| { @@ -1109,7 +1108,6 @@ test "a grip's four states, focused or not and clean or dirty, are each its own defer p.deinit(); const pane = try p.setTestFile("text\n"); p.newScratchBelow(0); - p.animate_theme_changes = false; var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); const State = struct { first: Cell, second: Cell, dirty: bool }; @@ -1150,7 +1148,6 @@ test "every theme draws a file's name, a +Errors and a Term word in a tint, neve p.acknowledgeShell(terminal, "/bin/sh", false); try @import("Output.zig").openErrors(p, 0, try gpa.dupe(u8, "oops\n")); while (p.nextEffect()) |_| {} - p.animate_theme_changes = false; const errors = for (p.panes, 0..) |slot, id| { const pane = slot orelse continue; if (pane.file) |f| if (std.mem.endsWith(u8, f.path, "+Errors")) break id; diff --git a/src/file_watch.zig b/src/file_watch.zig index a75383e1..7b8ccbef 100644 --- a/src/file_watch.zig +++ b/src/file_watch.zig @@ -575,7 +575,6 @@ pub fn applyThemeEffect( watches: *Table, generation: u32, on: bool, - animate: bool, ) bool { watchPane(fd, watches, theme_slot, null, 0, .{ .text = 0 }); if (!on) return false; @@ -589,7 +588,7 @@ pub fn applyThemeEffect( return false; }; defer gpa.free(bytes); - if (!colors.loadThemeFile(core, generation, bytes, animate)) { + if (!colors.loadThemeFile(core, generation, bytes)) { core.noteLateFailure(pane); return false; } @@ -626,7 +625,7 @@ pub fn reloadTheme( .text => |accepted| if (accepted == hash) return false, .pdf => unreachable, } - if (!colors.loadThemeFile(core, watched.serial, bytes, true)) return false; + if (!colors.loadThemeFile(core, watched.serial, bytes)) return false; core.invalidate(); const live = if (watches[theme_slot]) |*entry| entry else return false; if (live.serial != watched.serial) return false; @@ -848,7 +847,7 @@ test "theme watch reloads valid ZON and keeps the last theme across a bad save" if (fd < 0) return error.WatchInitFailed; defer _ = libc.close(fd); var watches: Table = @splat(null); - defer _ = applyThemeEffect(core, gpa, fd, &watches, 0, false, false); + defer _ = applyThemeEffect(core, gpa, fd, &watches, 0, false); try std.testing.expect(!applyThemeEffect( core, gpa, @@ -856,7 +855,6 @@ test "theme watch reloads valid ZON and keeps the last theme across a bad save" &watches, request.generation, true, - false, )); try std.testing.expectEqual(@as(?[3]u8, .{ 1, 2, 3 }), core.theme().bg); try std.testing.expect(watches[theme_slot] != null); diff --git a/src/gui/gui.zig b/src/gui/gui.zig index a81f029f..f5b486c1 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -4205,7 +4205,6 @@ fn watchTheme(ctx: ?*anyopaque, generation: u32, on: bool) void { s.watches, generation, on, - s.threads_ok, )) s.queue.push(.files_changed); } diff --git a/src/host_io.zig b/src/host_io.zig index 86e97876..0c638f71 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -116,7 +116,7 @@ pub fn restoreCore(gpa: std.mem.Allocator, core: *pardes.Pardes, path: []const u return null; }; file_watch.unwatchAll(inotify_fd, watches); - _ = file_watch.applyThemeEffect(core, gpa, inotify_fd, watches, 0, false, false); + _ = file_watch.applyThemeEffect(core, gpa, inotify_fd, watches, 0, false); return nc; } diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 2cfee904..ec870253 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1706,7 +1706,7 @@ test "a Restore asks again for the ThemeFile the dump names, as a /ctl write of var encoded: std.Io.Writer.Allocating = .init(gpa); defer encoded.deinit(); try std.zon.stringify.serialize(custom, .{}, &encoded.writer); - try testing.expect(pardes.colors.loadThemeFile(p, p.theme_file_generation, encoded.written(), false)); + try testing.expect(pardes.colors.loadThemeFile(p, p.theme_file_generation, encoded.written())); try pardes.dump.dumpState(p); const restored = try pardes.dump.restore(p, p.dump_out.?, "/tmp/pardes.dump.zon"); defer restored.deinit(); @@ -1741,9 +1741,9 @@ test "a ThemeFile that fails to load changes nothing: the root ctl still names t var encoded: std.Io.Writer.Allocating = .init(gpa); defer encoded.deinit(); try std.zon.stringify.serialize(custom, .{}, &encoded.writer); - try testing.expect(pardes.colors.loadThemeFile(p, p.theme_file_generation, encoded.written(), false)); + try testing.expect(pardes.colors.loadThemeFile(p, p.theme_file_generation, encoded.written())); _ = wr(p, root_ctl, "ThemeFile /tmp/pardes-bad-theme.zon\n"); - try testing.expect(!pardes.colors.loadThemeFile(p, p.theme_file_generation, ".{ .name = ", false)); + try testing.expect(!pardes.colors.loadThemeFile(p, p.theme_file_generation, ".{ .name = ")); try testing.expect(std.mem.indexOf(u8, rd(p, root_ctl, 0, 1 << 16).bytes, "ThemeFile " ++ good ++ "\n") != null); try testing.expectEqualStrings(good, p.theme_file_path.get()); } @@ -1760,7 +1760,7 @@ test "after a ThemeFile the root ctl and DumpConfig say ThemeFile and its path, var encoded: std.Io.Writer.Allocating = .init(gpa); defer encoded.deinit(); try std.zon.stringify.serialize(custom, .{}, &encoded.writer); - try testing.expect(pardes.colors.loadThemeFile(p, p.theme_file_generation, encoded.written(), false)); + try testing.expect(pardes.colors.loadThemeFile(p, p.theme_file_generation, encoded.written())); const settings = rd(p, root_ctl, 0, 1 << 16).bytes; try testing.expect(std.mem.indexOf(u8, settings, "ThemeFile " ++ path ++ "\n") != null); try testing.expect(std.mem.indexOf(u8, settings, "Theme mine") == null); diff --git a/src/pardes.zig b/src/pardes.zig index 63f8b61a..8204915d 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1065,7 +1065,6 @@ test "an empty column shows its theme's empty_col under its tag: acme's white, e tagline.exitHeader(p); inline for (.{ "acme", "dark" }) |name| { try std.testing.expect(p.executeBuiltinLine(0, "Theme " ++ name)); - p.chrome_animation.displayed = colors.ChromeTheme.fromTheme(p.theme()); p.sync(); var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); @@ -3367,7 +3366,7 @@ pub const Pardes = struct { theme_file_loaded: config.Runtime.Text(limits.host_path_cap) = .{}, theme_file_generation: u32 = 0, theme_file_pane: u8 = 0, - chrome_animation: colors.ChromeAnimation = colors.ChromeAnimation.init(colors.initial_chrome), + chrome: colors.ChromeTheme = colors.initial_chrome, /// The focused cursor's quad on its springs (animation.CursorGlide), /// the pane and view origin it was last aimed in, and the last key or /// click, which a blink holds for. @@ -3385,7 +3384,6 @@ pub const Pardes = struct { /// cursor waits where it was drawn for the release that places it. cursor_held: bool = false, input_ns: u64 = 0, - animate_theme_changes: bool = false, native_images: bool = false, /// The shell can take a changed image a few rows at a time (a texture row /// upload, a shared-memory hand-off), so a PDF selection is repainted as @@ -3602,7 +3600,7 @@ pub const Pardes = struct { pub const replica = .{ .local = .{ // A frame, and the animations and timings that make it. - "surface", "frames", "chrome_animation", + "surface", "frames", "chrome", "cursor_glide", "cursor_view", "cursor_crossing", "cursor_held", "frame_arena", "scratch", "needs_frame", "present_skipped", "shell_continuous", "native_image_patches", "echo", @@ -5295,7 +5293,6 @@ pub const Pardes = struct { }, .tick => { mouse.edgeScroll(p); - p.chrome_animation.advance(); look.advanceLookHover(p); }, } @@ -6802,10 +6799,9 @@ pub const Pardes = struct { return &themes[p.settings.theme]; } - /// Displayed colors for anchored UI chrome. Unlike `theme()`, this may be - /// between themes while a live transition is active. + /// The colours of the chrome: the theme's, set as it changes. pub fn chromeTheme(p: *const Pardes) *const ChromeTheme { - return &p.chrome_animation.displayed; + return &p.chrome; } /// The theme's own chrome, not a fade's (`theme()`'s, worked out once @@ -6830,7 +6826,6 @@ pub const Pardes = struct { // the next frame (writes served before the shell's clock was first // seen are stamped 0, which `advance` would count back from). if (p.fs.batch.bytes.items.len > 0) return @max(next, p.fs.batch.last_ns + ctlfs.pane.batch_pause_ns); - if (p.chrome_animation.isActive()) return next; // Places still to find resume on the next frame; a picture being // decoded is looked for. for (p.panes) |slot| if (slot) |pane| if (pane.places.busy(pane)) return next; @@ -8066,45 +8061,6 @@ test "jump history terminal rectangle follows output and clears on reflow" { try std.testing.expectEqual(.none, pane.sel[0].state); } -test "core animation keeps wall time at 60, 120 and 144 Hz and across a stall" { - const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); - defer p.deinit(); - const frame = animation.frame_ns; - // Something that animates for as long as the test wants: the theme - // fade, held at its start before every step. - for ([_]u64{ 60, 120, 144 }) |hz| { - const start: u64 = 5 * std.time.ns_per_s; - p.clock_started = false; - p.advance(start); - var steps: u64 = 0; - var at: u64 = 1; - while (at <= hz) : (at += 1) { - const before = p.stepped_ns; - p.chrome_animation.step = 0; - p.advance(start + at * std.time.ns_per_s / hz); - const taken = (p.stepped_ns - before + frame / 2) / frame; - // Never two steps in one display frame: that is a visible hitch. - try std.testing.expect(taken <= 1); - steps += taken; - } - switch (hz) { - // One step a display frame, every display frame. - 60 => try std.testing.expectEqual(@as(u64, 60), steps), - 120 => try std.testing.expectEqual(@as(u64, 60), steps), - // The frame's own rate: 62 a second, give or take one. - else => try std.testing.expect(steps >= 61 and steps <= 63), - } - } - // A stall of minutes is not minutes of frames. - const before = p.stepped_ns; - p.chrome_animation.step = 0; - p.advance(before + 600 * std.time.ns_per_s); - try std.testing.expectEqual(before + 600 * std.time.ns_per_s, p.stepped_ns); - p.chrome_animation.step = animation.transition_steps; - p.advance(p.stepped_ns + frame); - try std.testing.expectEqual(@as(?u64, null), p.nextWake()); -} - test "a Save the host could not do logs no save record" { const th = @import("ninep/testing.zig"); const p = try th.withFile(std.testing.allocator, "x\n"); diff --git a/src/tui/tui.zig b/src/tui/tui.zig index 2a067ed3..319e6c1b 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -2852,7 +2852,7 @@ const Shell = struct { fn watchTheme(ctx: ?*anyopaque, generation: u32, on: bool) void { const s = of(ctx); - if (file_watch.applyThemeEffect(s.core, s.gpa, s.inotify_fd, &s.watches, generation, on, s.threads_ok)) + if (file_watch.applyThemeEffect(s.core, s.gpa, s.inotify_fd, &s.watches, generation, on)) s.loop.postEvent(.files_changed) catch {}; } diff --git a/src/wire.zig b/src/wire.zig index e29a98b4..3406321b 100644 --- a/src/wire.zig +++ b/src/wire.zig @@ -51,14 +51,13 @@ const family = switch (config.platform) { pub const semantics: u64 = blk: { @setEvalBranchQuota(1_000_000); break :blk std.hash.Wyhash.hash(0, std.fmt.comptimePrint( - "wire {d}\npardes {s} {s}\n{s} grammars {} {} {} {} mupdf {} themes {} workspace_tag {} sources {}\nusize {d} {t}\n{s}\n{s}", + "wire {d}\npardes {s} {s}\n{s} grammars {} {} {} {} mupdf {} workspace_tag {} sources {}\nusize {d} {t}\n{s}\n{s}", .{ version, config.version, config.commit orelse "unstamped", family, config.syntax_highlighting, config.syntax_zig_grammar, config.syntax_minimal_grammars, config.syntax_full_grammars, config.mupdf, - config.theme_animation, config.workspace_tag, config.embed_sources, - @sizeOf(usize), builtin.cpu.arch.endian(), config.deps, - pardes.tape.shape, + config.workspace_tag, config.embed_sources, @sizeOf(usize), + builtin.cpu.arch.endian(), config.deps, pardes.tape.shape, }, )); }; |
