From 87ad46cb7e7410c53419c20cef7df53ed4c15f60 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 07:31:35 -0300 Subject: G11: HoverGlow, a soft underline of light under a look-hover's word HoverGlow on|off (off, a pixel shell's; Chrome.glows bit 1, SelectionGlow bit 0 now that there are two): under the word a look-hover would open (its cells in the affordance's tint) a strip three logical pixels tall along its foot, blurred by one, in the theme's accent, at most 22% and under the text's contrast floor, fading in over 80 ms; kept to the bodies and split round a cursor. glowBlocks serves G9 and G11. The strip is cast from a row away so addSoft's caster cut-out misses it. Tests: the glow comes up by 90 ms and never falls on the cursor's cell. Gates as G10 (a loaded machine shifted the GUI goldens a scene once; a rerun matched 01-08). Feel review: .scratch/render/hover/. --- docs/effects.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'docs/effects.md') diff --git a/docs/effects.md b/docs/effects.md index 0e0ad51a..c11ff070 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -44,6 +44,7 @@ why. The verdict is the user's. | G8 notice chips | follows `Motion` and `Lift` | a notice floats in tier 4 on a lift (shadow) while Lift is on, drops in easing out and dissolves easing in, quicker than it came (150 ms against 180) | .scratch/render/notices/ (acme, forge) | pending | | G9 selection glow | `SelectionGlow on\|off` (off) | a soft halo of the selection's colour round each block of it in a body, fading in over 100 ms | .scratch/render/selection/ (forge, acme, lapis; lapis-glow-zoom.png) | pending | | G10 theme crossfade | always (a theme change) | the chrome's colours fade through OKLab, easing in and out (out when retargeted) | .scratch/render/crossfade/ (forge, lapis, acme cut short by dusk) | pending | +| G11 look-hover glow | `HoverGlow on\|off` (off) | a soft underline of the theme's accent under the word a look-hover would open, fading in over 80 ms | .scratch/render/hover/ (forge, acme, lapis; zooms) | pending | ## Motion flavours @@ -207,3 +208,14 @@ muddy, on a smooth ease-in-out; a change made mid-fade sets off from where it shows and eases out, so it moves at once instead of stalling. The page, its text and the syntax colours still change at once with the theme, as before: fading them would re-resolve every cell each frame. + +Notes on G11: the word a look-hover would open is already lit (the +affordance's tint); HoverGlow adds a strip three logical pixels tall along +its foot in the theme's accent, its edges blurred by one, at most 22% and +under the text's contrast floor, fading in over 80 ms (micro-feedback). It +stays on bodies and is split round a cursor, so it never touches one. The +word is found by the tint's colour, as G9 finds the selection. +Found while reviewing: with the machine loaded, test/gui_golden.py's +two-captures-agree settle can take a scene's frame before the scene's +change lands, and every later hash moves up a scene; a rerun on a quiet +machine matches. -- cgit v1.3 From ab668719385c94df3e274f71cb744f5917c1da7e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 07:47:39 -0300 Subject: G12: Occlusion, pane bodies darkening faintly toward their edges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Occlusion on|off (off, a pixel shell's; Chrome.fx bit 2 — the glow bits field is now `fx`): four soft strips cast from just outside each pane body inward, clipped to the body and round a cursor, black pre-warped to linear light, 2% at most (§9.1) and under the lift's contrast ceiling, in the pane's own group. Tests: the shade stays inside the body, off the cursor, at most 2%. Gates as G11. Feel review: .scratch/render/occlusion/ (with an x40 diff). --- docs/config.md | 2 ++ docs/effects.md | 8 +++++ src/config.zig | 12 +++++-- src/detached/wire.zig | 2 +- src/draw.zig | 2 +- src/gui/gui.zig | 91 +++++++++++++++++++++++++++++++++++++++++++++++---- src/surface.zig | 9 ++--- 7 files changed, 111 insertions(+), 15 deletions(-) (limited to 'docs/effects.md') diff --git a/docs/config.md b/docs/config.md index cd1244f7..44f37079 100644 --- a/docs/config.md +++ b/docs/config.md @@ -576,6 +576,8 @@ SelectionGlow on a soft halo of the selection's colour round it in the body, fading in over 100 ms, never over a tag, a grip or the cursor HoverGlow on a soft glow under the word a look-hover would open, fading in over 80 ms +Occlusion on pane bodies darken faintly toward their edges (2%), never + over the cursor CursorBlink on the cursor blinks, solid while typing and half a second after, eased at each edge, solid after 10 idle seconds GripWidth 150 the grip's button and the scrollbar under it, percent of the diff --git a/docs/effects.md b/docs/effects.md index c11ff070..ad454775 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -45,6 +45,7 @@ why. The verdict is the user's. | G9 selection glow | `SelectionGlow on\|off` (off) | a soft halo of the selection's colour round each block of it in a body, fading in over 100 ms | .scratch/render/selection/ (forge, acme, lapis; lapis-glow-zoom.png) | pending | | G10 theme crossfade | always (a theme change) | the chrome's colours fade through OKLab, easing in and out (out when retargeted) | .scratch/render/crossfade/ (forge, lapis, acme cut short by dusk) | pending | | G11 look-hover glow | `HoverGlow on\|off` (off) | a soft underline of the theme's accent under the word a look-hover would open, fading in over 80 ms | .scratch/render/hover/ (forge, acme, lapis; zooms) | pending | +| G12 ambient occlusion | `Occlusion on\|off` (off) | pane bodies darken toward their edges, at most 2% (§9.1: 1 to 2%) | .scratch/render/occlusion/ (on/off on forge, acme, lapis; acme-diff-x40.png) | pending | ## Motion flavours @@ -219,3 +220,10 @@ Found while reviewing: with the machine loaded, test/gui_golden.py's two-captures-agree settle can take a scene's frame before the scene's change lands, and every later hash moves up a scene; a rerun on a quiet machine matches. + +Notes on G12: four soft strips cast from just outside each body inward, +clipped to it and round a cursor, black in linear light, 2% at most and +under the lift's contrast ceiling, in the pane's own group so it moves +with it. At §9.1's strength it is all but invisible on a dark page (a +level of 255 on forge) and faint on a light one (acme's page steps one +level toward the edges); acme-diff-x40.png shows where it falls. diff --git a/src/config.zig b/src/config.zig index 4e159d01..22e65c46 100644 --- a/src/config.zig +++ b/src/config.zig @@ -124,6 +124,7 @@ pub const leader_path = paths: { if (builtins.capabilities.lift) table.set(.CursorBlink, null); if (builtins.capabilities.lift) table.set(.SelectionGlow, null); if (builtins.capabilities.lift) table.set(.HoverGlow, null); + if (builtins.capabilities.lift) table.set(.Occlusion, null); if (builtins.capabilities.lift) table.set(.Lift, null); table.set(.Motion, null); table.set(.InactiveDim, null); @@ -674,6 +675,9 @@ pub const Runtime = struct { /// G11: a soft glow under the word a look-hover would open, fading in /// over 80 ms, a pixel shell's. hover_glow: bool = false, + /// G12: pane bodies darken faintly toward their edges (ambient + /// occlusion, at most 2%), a pixel shell's. + occlusion: bool = false, /// How long a message stays after the key or click that dismisses it. message_linger_ms: u16 = 800, /// How long its fall into the row takes, easing out (§8.1: arriving, @@ -897,7 +901,7 @@ pub const Runtime = struct { /// The message timings a setting word sets, each in milliseconds. pub const MessageTime = enum { linger, fall, dissolve }; - pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow }; + pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion }; /// A bundled post pass, a Shadertoy file in shaders/post/: the CRT, and /// G4's bloom, vignette and grain (docs/effects.md). pub const Scene = enum { crt, bloom, vignette, grain }; @@ -958,6 +962,7 @@ pub const Runtime = struct { .{ .word = "CursorBlink", .action = .{ .toggle = .cursor_blink }, .availability = .lift, .doc = "The cursor blinks, solid while typing, on or off." }, .{ .word = "SelectionGlow", .action = .{ .toggle = .selection_glow }, .availability = .lift, .doc = "A soft halo of the selection's colour round it in the body, on or off." }, .{ .word = "HoverGlow", .action = .{ .toggle = .hover_glow }, .availability = .lift, .doc = "A soft underline of light under the word a look-hover would open, on or off." }, + .{ .word = "Occlusion", .action = .{ .toggle = .occlusion }, .availability = .lift, .doc = "Pane bodies darken faintly toward their edges, on or off." }, .{ .word = "Lift", .action = .lift, .availability = .lift, .doc = "How the focused pane stands off the page: off, shadow, rim or auto." }, .{ .word = "Motion", .action = .motion, .doc = "How animations move: off, crisp, smooth, bouncy or playful." }, .{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." }, @@ -1034,9 +1039,9 @@ pub const Runtime = struct { .toggle => |field| if (field == .ligatures) { if (setting.availability != .ligatures) @compileError("the ligatures toggle must use the ligatures capability"); - } else if (field == .cursor_blink or field == .selection_glow or field == .hover_glow) { + } else if (field == .cursor_blink or field == .selection_glow or field == .hover_glow or field == .occlusion) { if (setting.availability != .lift) - @compileError("CursorBlink, SelectionGlow and HoverGlow must use the lift capability (a pixel shell's)"); + @compileError("CursorBlink, SelectionGlow, HoverGlow and Occlusion must use the lift capability (a pixel shell's)"); } else if (setting.availability != null) @compileError("unconditional toggles cannot carry a backend capability"), else => if (setting.availability != null) @@ -1693,6 +1698,7 @@ pub const Runtime = struct { .cursor_blink => "CursorBlink off\n", .selection_glow => "SelectionGlow on\n", .hover_glow => "HoverGlow on\n", + .occlusion => "Occlusion on\n", }, .shell => "Shell requested (new panes) fish\n", .tagline_size => "TaglineSize 73\n", diff --git a/src/detached/wire.zig b/src/detached/wire.zig index cf5a8711..3a914e42 100644 --- a/src/detached/wire.zig +++ b/src/detached/wire.zig @@ -13,7 +13,7 @@ pub const version: u16 = 8; /// The Chrome palette is carried field by field as its declaration lists /// them, so any change to it changes the wire: bump `version`, then this. -const chrome_layout: u64 = 0x3195816f182fe5bc; +const chrome_layout: u64 = 0x5e758b47fb0cf8da; comptime { @setEvalBranchQuota(10_000); var hash = std.hash.Fnv1a_64.init(); diff --git a/src/draw.zig b/src/draw.zig index 5e40f0fa..027326fa 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -472,7 +472,7 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { .rail_px = @intCast(@min(255, @as(u32, p.theme().rail_px orelse 12) * p.settings.grip_width / 100)), .name_ink = chrome.tag_name_fg, .active_name_ink = if (p.settings.focus_tint) chrome.tag_active_name_fg else chrome.tag_name_fg, - .glows = @as(u8, @intFromBool(p.settings.selection_glow)) | @as(u8, @intFromBool(p.settings.hover_glow)) << 1, + .fx = @as(u8, @intFromBool(p.settings.selection_glow)) | @as(u8, @intFromBool(p.settings.hover_glow)) << 1 | @as(u8, @intFromBool(p.settings.occlusion)) << 2, }; if (p.theme().decor) |decor| { s.chrome.decor_dots = decor.page_dots; diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 45861ea4..6bde8b60 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -5815,9 +5815,9 @@ fn renderFrame( if (g.glide.pending) g.glide.measure(gpa, surface); g.sel_glow.now_ns = if (core) |p| p.now_ns else c.SDL_GetTicksNS(); // Off, or while panes move, no glow and nothing fading. - if (surface.chrome.glows & 1 == 0 or surface.panelTracks().len != 0) g.sel_glow = .{ .now_ns = g.sel_glow.now_ns }; + if (surface.chrome.fx & 1 == 0 or surface.panelTracks().len != 0) g.sel_glow = .{ .now_ns = g.sel_glow.now_ns }; g.hover_glow.now_ns = g.sel_glow.now_ns; - if (surface.chrome.glows & 2 == 0 or surface.panelTracks().len != 0) g.hover_glow = .{ .now_ns = g.sel_glow.now_ns }; + if (surface.chrome.fx & 2 == 0 or surface.panelTracks().len != 0) g.hover_glow = .{ .now_ns = g.sel_glow.now_ns }; if (g.glide.moving()) g.glide.offset = g.glide.spring.value(g.glide.now_ns); cell_decor = CellDecor.of(chrome); // Plaques need an opaque window: with WindowOpacity under 100 the cells @@ -8708,9 +8708,11 @@ fn buildDecor(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface, g const bodies = body_buf[0..nbodies]; try paneDecor(g, gpa, placed, groups, index, chrome, layout, surface.cols, surface.rows, win_w, win_h, track); // G9, while nothing moves: a halo round the body's selection. - if (index == 0 and groups.tracks == 0 and chrome.glows & 1 != 0) try glowBlocks(g, gpa, surface, .selection, layout, win_w, win_h); + if (index == 0 and groups.tracks == 0 and chrome.fx & 1 != 0) try glowBlocks(g, gpa, surface, .selection, layout, win_w, win_h); // G11: a glow under the word a look-hover would open. - if (index == 0 and groups.tracks == 0 and chrome.glows & 2 != 0) try glowBlocks(g, gpa, surface, .hover, layout, win_w, win_h); + if (index == 0 and groups.tracks == 0 and chrome.fx & 2 != 0) try glowBlocks(g, gpa, surface, .hover, layout, win_w, win_h); + // G12: the bodies' edges shaded, a pane's in its own group. + if (chrome.fx & 4 != 0) try occlusion(g, gpa, placed, groups, index, surface, ceilings, layout, win_w, win_h, track); // A single spine runs down each column, through every tag and body. if (index == 0) for (regions) |column| { if (column.kind != .column) continue; @@ -9092,6 +9094,44 @@ fn glowBlocks(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface, k tracker.* = next; } +/// G12: ambient occlusion, a pane body darkening faintly toward its edges +/// (§9.1: an inner shadow of 1 to 2%): four soft strips cast from just +/// outside the body inward, clipped to it and round a cursor, black in +/// linear light, under the same contrast ceiling as a lift. +fn occlusion(g: *Gui, gpa: std.mem.Allocator, regions: []const pardes.Region, groups: *const Groups, index: usize, surface: *const pardes.Surface, ceilings: LiftCeilings, layout: CellLayout, win_w: f32, win_h: f32, track: ?pardes.animation.Track) !void { + const strength = @min(0.02, ceilings.shadow); + if (strength <= 0.002) return; + const reach = 0.5 * layout.h; + for (regions) |body| { + if (body.kind != .body or body.rect.w == 0 or body.rect.h == 0 or groupOf(groups, body.serial) != index) continue; + const b = bodyPixels(body, layout); + // The body, less a cursor's cell in it: left, right, above, below. + var parts: [4][4]f32 = undefined; + var nparts: usize = 0; + const cursor: ?[4]f32 = if (surface.cursor) |cu| .{ @as(f32, @floatFromInt(cu.x)) * layout.w, @as(f32, @floatFromInt(cu.y)) * layout.h, @as(f32, @floatFromInt(cu.x + 1)) * layout.w, @as(f32, @floatFromInt(cu.y + 1)) * layout.h } else null; + if (cursor) |cb| if (!(cb[0] >= b[2] or cb[2] <= b[0] or cb[1] >= b[3] or cb[3] <= b[1])) { + parts = .{ .{ b[0], b[1], cb[0], b[3] }, .{ cb[2], b[1], b[2], b[3] }, .{ cb[0], b[1], cb[2], cb[1] }, .{ cb[0], cb[3], cb[2], b[3] } }; + nparts = 4; + }; + if (nparts == 0) { + parts[0] = b; + nparts = 1; + } + const t = reach / 3; + const strips = [_][4]f32{ + .{ b[0], b[1] - t, b[2], b[1] }, + .{ b[0], b[3], b[2], b[3] + t }, + .{ b[0] - t, b[1], b[0], b[3] }, + .{ b[2], b[1], b[2] + t, b[3] }, + }; + for (strips) |strip| { + const first = g.decor.items.len; + try addSoft(g, gpa, strip, reach / 3, 0, 0, strength, .{ 0, 0, 0 }, track, win_w, win_h); + try clipToBodies(g, gpa, first, parts[0..nparts]); + } + } +} + /// A theme's tag plaques (Chrome.decor_box_*), drawn under the cells of /// group `index`: each pane tag, and with the still panes the column and /// workspace tags, becomes a framed box inside its own band with a hard @@ -9536,7 +9576,7 @@ test "the selection glows round its block, on the body only, fading in over 100 core.settings.selection_glow = true; pardes.test_api.sync(core); const s = try core.render(core.scratch.allocator()); - try std.testing.expectEqual(@as(u8, 1), s.chrome.glows); + try std.testing.expectEqual(@as(u8, 1), s.chrome.fx); // Two rows of a selection in the body, as the core paints one. const body = for (s.regionList()) |region| { if (region.kind == .body) break region; @@ -9586,7 +9626,7 @@ test "a hovered word glows along its foot, never over the cursor, fading in over core.settings.hover_glow = true; pardes.test_api.sync(core); const s = try core.render(core.scratch.allocator()); - try std.testing.expectEqual(@as(u8, 2), s.chrome.glows); + try std.testing.expectEqual(@as(u8, 2), s.chrome.fx); const body = for (s.regionList()) |region| { if (region.kind == .body) break region; } else return error.NoBody; @@ -9628,6 +9668,45 @@ test "a hovered word glows along its foot, never over the cursor, fading in over try std.testing.expect(!g.hover_glow.fading); } +test "occlusion shades each body's edges, inside it, never a tag, a grip or the cursor" { + const gpa = std.testing.allocator; + const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); + defer core.deinit(); + _ = try core.setTestFile("some text on a line\n" ** 30); + core.settings.occlusion = true; + pardes.test_api.sync(core); + const s = try core.render(core.scratch.allocator()); + try std.testing.expectEqual(@as(u8, 4), s.chrome.fx); + const body = for (s.regionList()) |region| { + if (region.kind == .body) break region; + } else return error.NoBody; + // The cursor on the body's top-left cell, where the shade is. + s.cursor = .{ .x = body.rect.x, .y = body.rect.y }; + var g: Gui = undefined; + g.decor = .empty; + defer g.decor.deinit(gpa); + g.cell_w = 10; + g.cell_h = 20; + g.tagline_width = 6; + g.tagline_height = 12; + g.sel_glow = .{}; + g.hover_glow = .{}; + var groups = makeGroups(&.{}, false); + try buildDecor(&g, gpa, s, &groups, fixedCellLayout(&g), 800, 480, true); + const r = bodyPixels(body, fixedCellLayout(&g)); + var shades: usize = 0; + for (g.decor.items) |item| { + if (item.effect & soft_shadow_bit == 0) continue; + shades += 1; + try std.testing.expect(item.fr <= 0.02 + 1e-6); + try std.testing.expect(item.clip_x0 >= r[0] - 0.01 and item.clip_x1 <= r[2] + 0.01 and item.clip_y0 >= r[1] - 0.01 and item.clip_y1 <= r[3] + 0.01); + const cx: f32 = @floatFromInt(@as(u32, s.cursor.?.x) * 10); + const cy: f32 = @floatFromInt(@as(u32, s.cursor.?.y) * 20); + try std.testing.expect(item.clip_x1 <= cx + 0.01 or item.clip_x0 >= cx + 10 - 0.01 or item.clip_y1 <= cy + 0.01 or item.clip_y0 >= cy + 20 - 0.01); + } + try std.testing.expect(shades >= 4); +} + /// What a bundled post pass leaves alone (Post.Frame.spare), in window /// pixels: every tag with its grip, the column and workspace tags, and the /// notices, the chrome the focus indicators live in. A grip, the gap after diff --git a/src/surface.zig b/src/surface.zig index 26783df4..02e4bb5d 100644 --- a/src/surface.zig +++ b/src/surface.zig @@ -448,10 +448,11 @@ pub const Chrome = struct { decor_title_px: u8 = 2, name_ink: [3]u8 = .{ 0, 0, 0 }, active_name_ink: [3]u8 = .{ 0, 0, 0 }, - /// A pixel shell's glows: bit 0 round the body's selection (G9, - /// SelectionGlow), bit 1 under the word a look-hover would open (G11, - /// HoverGlow). - glows: u8 = 0, + /// A pixel shell's small effects: bit 0 a glow round the body's + /// selection (G9, SelectionGlow), bit 1 one under the word a look-hover + /// would open (G11, HoverGlow), bit 2 the bodies' edge shade (G12, + /// Occlusion). + fx: u8 = 0, }; /// The canonical interface: what a frame of pardes IS. The tty shell writes -- cgit v1.3 From 0a2694e935fa8a79f1a399f2d2cbc643f8c3734e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 08:28:40 -0300 Subject: G13: Parallax, lapis's dots drift with the text at a quarter of its speed Parallax on|off (off, a pixel shell's; Chrome.fx bit 3). A body region carries its first line (Region.line, a file's scroll or a terminal's grid offset; the wire's region record grows a u32). The GUI offsets each body's page dots by a quarter of its line in rows, and of G6's glide offset while one runs, so the pattern drifts with the text and settles with it; the cell shader reads it from the instance's serial slot, whose per-cell dissolve noise G7 left unused (the dead noise code goes). Tests: a scrolled body tells its line; the shift handed to the shader is a quarter of it within the dots' period. Measured in a capture: four lines move the dots 13 px (140 px / 4 mod 22). Gates as before, goldens byte-identical. Feel review: .scratch/render/parallax/. --- docs/config.md | 2 ++ docs/effects.md | 10 ++++++++ shaders/prebuilt/ui.frag.glsl | 18 +++---------- shaders/prebuilt/ui.frag.spv | Bin 8176 -> 6968 bytes shaders/ui.frag.glsl | 18 +++---------- src/config.zig | 12 ++++++--- src/detached/wire.zig | 4 ++- src/draw.zig | 5 ++-- src/gui/gui.zig | 57 +++++++++++++++++++++++++++++++++++++++++- src/surface.zig | 6 ++++- 10 files changed, 96 insertions(+), 36 deletions(-) (limited to 'docs/effects.md') diff --git a/docs/config.md b/docs/config.md index 44f37079..97bf95a1 100644 --- a/docs/config.md +++ b/docs/config.md @@ -578,6 +578,8 @@ HoverGlow on a soft glow under the word a look-hover would open, fading in over 80 ms Occlusion on pane bodies darken faintly toward their edges (2%), never over the cursor +Parallax on a theme's page pattern (lapis's dots) moves with the text + at a quarter of its speed CursorBlink on the cursor blinks, solid while typing and half a second after, eased at each edge, solid after 10 idle seconds GripWidth 150 the grip's button and the scrollbar under it, percent of the diff --git a/docs/effects.md b/docs/effects.md index ad454775..fbb44dfa 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -46,6 +46,7 @@ why. The verdict is the user's. | G10 theme crossfade | always (a theme change) | the chrome's colours fade through OKLab, easing in and out (out when retargeted) | .scratch/render/crossfade/ (forge, lapis, acme cut short by dusk) | pending | | G11 look-hover glow | `HoverGlow on\|off` (off) | a soft underline of the theme's accent under the word a look-hover would open, fading in over 80 ms | .scratch/render/hover/ (forge, acme, lapis; zooms) | pending | | G12 ambient occlusion | `Occlusion on\|off` (off) | pane bodies darken toward their edges, at most 2% (§9.1: 1 to 2%) | .scratch/render/occlusion/ (on/off on forge, acme, lapis; acme-diff-x40.png) | pending | +| G13 parallax | `Parallax on\|off` (off) | a theme's page pattern under the bodies (lapis's dots) moves with the text at a quarter of its speed, glides included | .scratch/render/parallax/ (lapis, notches down and up) | pending | ## Motion flavours @@ -227,3 +228,12 @@ under the lift's contrast ceiling, in the pane's own group so it moves with it. At §9.1's strength it is all but invisible on a dark page (a level of 255 on forge) and faint on a light one (acme's page steps one level toward the edges); acme-diff-x40.png shows where it falls. + +Notes on G13: a body region now carries its first line (Region.line: a +file's scroll, a terminal's grid offset; on the wire, a u32 more a +region). Under Parallax the dots under each body are offset by a quarter +of its line times the row height, plus G6's glide offset while one runs, +so they drift with the text as it glides and settle with it (measured: 4 +lines at 35 px move the 22 px grid 13 px, 35 mod 22). The cell shader +reads the offset from the instance's serial slot, free since G7 took the +dissolve's per-cell noise out. Without a pattern, nothing happens. diff --git a/shaders/prebuilt/ui.frag.glsl b/shaders/prebuilt/ui.frag.glsl index cb38fff1..51ec5b8c 100644 --- a/shaders/prebuilt/ui.frag.glsl +++ b/shaders/prebuilt/ui.frag.glsl @@ -27,16 +27,6 @@ layout(location = 5) flat in vec4 v_clip; layout(location = 0) out vec4 o_col; -float cellNoise(uint serial, uint col, uint row) { - uint x = serial ^ (col * 0x9e3779b9u) ^ (row * 0x85ebca6bu); - x ^= x >> 16; - x *= 0x7feb352du; - x ^= x >> 15; - x *= 0x846ca68bu; - x ^= x >> 16; - return float(x & 0xffffu) / 65535.0; -} - void main() { if (v_clip.z >= v_clip.x && (gl_FragCoord.x < v_clip.x || gl_FragCoord.x >= v_clip.z || gl_FragCoord.y < v_clip.y || gl_FragCoord.y >= v_clip.w)) discard; @@ -51,9 +41,6 @@ void main() { : clamp(u_ui.background_opacity, 0.0, 1.0); uint effect = v_effect.x & 0x07ffffffu; float progress = clamp(uintBitsToFloat(v_effect.y), 0.0, 1.0); - uint cellCol = v_effect.w & 0xffffu; - uint cellRow = v_effect.w >> 16; - float noise = cellNoise(v_effect.z, cellCol, cellRow); // Ink over ground, both premultiplied: v_fg*a + (v_bg*bgA)*(1-a), which is // mix() with the ground already premultiplied. At bgA = 1 that is exactly @@ -63,7 +50,10 @@ void main() { // dot every period pixels, fixed to the window, under the text. if ((v_effect.x & 0x10000000u) != 0u) { float period = u_ui.decor_dot_geom.x; - vec2 d = mod(gl_FragCoord.xy, period) - 0.5 * period; + // v_effect.z: how far its pane's text has moved the dots (G13's + // parallax), in pixels, as a float's bits (0 without). + vec2 at = gl_FragCoord.xy - vec2(0.0, uintBitsToFloat(v_effect.z)); + vec2 d = mod(at, period) - 0.5 * period; float dot_a = 1.0 - smoothstep(u_ui.decor_dot_geom.y, u_ui.decor_dot_geom.z, length(d)); ground = mix(ground, u_ui.decor_dots.rgb, u_ui.decor_dots.a * dot_a); } diff --git a/shaders/prebuilt/ui.frag.spv b/shaders/prebuilt/ui.frag.spv index 15318214..02e3edc4 100644 Binary files a/shaders/prebuilt/ui.frag.spv and b/shaders/prebuilt/ui.frag.spv differ diff --git a/shaders/ui.frag.glsl b/shaders/ui.frag.glsl index cb38fff1..51ec5b8c 100644 --- a/shaders/ui.frag.glsl +++ b/shaders/ui.frag.glsl @@ -27,16 +27,6 @@ layout(location = 5) flat in vec4 v_clip; layout(location = 0) out vec4 o_col; -float cellNoise(uint serial, uint col, uint row) { - uint x = serial ^ (col * 0x9e3779b9u) ^ (row * 0x85ebca6bu); - x ^= x >> 16; - x *= 0x7feb352du; - x ^= x >> 15; - x *= 0x846ca68bu; - x ^= x >> 16; - return float(x & 0xffffu) / 65535.0; -} - void main() { if (v_clip.z >= v_clip.x && (gl_FragCoord.x < v_clip.x || gl_FragCoord.x >= v_clip.z || gl_FragCoord.y < v_clip.y || gl_FragCoord.y >= v_clip.w)) discard; @@ -51,9 +41,6 @@ void main() { : clamp(u_ui.background_opacity, 0.0, 1.0); uint effect = v_effect.x & 0x07ffffffu; float progress = clamp(uintBitsToFloat(v_effect.y), 0.0, 1.0); - uint cellCol = v_effect.w & 0xffffu; - uint cellRow = v_effect.w >> 16; - float noise = cellNoise(v_effect.z, cellCol, cellRow); // Ink over ground, both premultiplied: v_fg*a + (v_bg*bgA)*(1-a), which is // mix() with the ground already premultiplied. At bgA = 1 that is exactly @@ -63,7 +50,10 @@ void main() { // dot every period pixels, fixed to the window, under the text. if ((v_effect.x & 0x10000000u) != 0u) { float period = u_ui.decor_dot_geom.x; - vec2 d = mod(gl_FragCoord.xy, period) - 0.5 * period; + // v_effect.z: how far its pane's text has moved the dots (G13's + // parallax), in pixels, as a float's bits (0 without). + vec2 at = gl_FragCoord.xy - vec2(0.0, uintBitsToFloat(v_effect.z)); + vec2 d = mod(at, period) - 0.5 * period; float dot_a = 1.0 - smoothstep(u_ui.decor_dot_geom.y, u_ui.decor_dot_geom.z, length(d)); ground = mix(ground, u_ui.decor_dots.rgb, u_ui.decor_dots.a * dot_a); } diff --git a/src/config.zig b/src/config.zig index 22e65c46..d11cbe76 100644 --- a/src/config.zig +++ b/src/config.zig @@ -125,6 +125,7 @@ pub const leader_path = paths: { if (builtins.capabilities.lift) table.set(.SelectionGlow, null); if (builtins.capabilities.lift) table.set(.HoverGlow, null); if (builtins.capabilities.lift) table.set(.Occlusion, null); + if (builtins.capabilities.lift) table.set(.Parallax, null); if (builtins.capabilities.lift) table.set(.Lift, null); table.set(.Motion, null); table.set(.InactiveDim, null); @@ -678,6 +679,9 @@ pub const Runtime = struct { /// G12: pane bodies darken faintly toward their edges (ambient /// occlusion, at most 2%), a pixel shell's. occlusion: bool = false, + /// G13: a theme's page pattern under the bodies (lapis's dots) moves + /// with the text at a quarter of its speed, a pixel shell's. + parallax: bool = false, /// How long a message stays after the key or click that dismisses it. message_linger_ms: u16 = 800, /// How long its fall into the row takes, easing out (§8.1: arriving, @@ -901,7 +905,7 @@ pub const Runtime = struct { /// The message timings a setting word sets, each in milliseconds. pub const MessageTime = enum { linger, fall, dissolve }; - pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion }; + pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax }; /// A bundled post pass, a Shadertoy file in shaders/post/: the CRT, and /// G4's bloom, vignette and grain (docs/effects.md). pub const Scene = enum { crt, bloom, vignette, grain }; @@ -963,6 +967,7 @@ pub const Runtime = struct { .{ .word = "SelectionGlow", .action = .{ .toggle = .selection_glow }, .availability = .lift, .doc = "A soft halo of the selection's colour round it in the body, on or off." }, .{ .word = "HoverGlow", .action = .{ .toggle = .hover_glow }, .availability = .lift, .doc = "A soft underline of light under the word a look-hover would open, on or off." }, .{ .word = "Occlusion", .action = .{ .toggle = .occlusion }, .availability = .lift, .doc = "Pane bodies darken faintly toward their edges, on or off." }, + .{ .word = "Parallax", .action = .{ .toggle = .parallax }, .availability = .lift, .doc = "A theme's page pattern moves with the text at a quarter of its speed, on or off." }, .{ .word = "Lift", .action = .lift, .availability = .lift, .doc = "How the focused pane stands off the page: off, shadow, rim or auto." }, .{ .word = "Motion", .action = .motion, .doc = "How animations move: off, crisp, smooth, bouncy or playful." }, .{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." }, @@ -1039,9 +1044,9 @@ pub const Runtime = struct { .toggle => |field| if (field == .ligatures) { if (setting.availability != .ligatures) @compileError("the ligatures toggle must use the ligatures capability"); - } else if (field == .cursor_blink or field == .selection_glow or field == .hover_glow or field == .occlusion) { + } else if (field == .cursor_blink or field == .selection_glow or field == .hover_glow or field == .occlusion or field == .parallax) { if (setting.availability != .lift) - @compileError("CursorBlink, SelectionGlow, HoverGlow and Occlusion must use the lift capability (a pixel shell's)"); + @compileError("CursorBlink, SelectionGlow, HoverGlow, Occlusion and Parallax must use the lift capability (a pixel shell's)"); } else if (setting.availability != null) @compileError("unconditional toggles cannot carry a backend capability"), else => if (setting.availability != null) @@ -1699,6 +1704,7 @@ pub const Runtime = struct { .selection_glow => "SelectionGlow on\n", .hover_glow => "HoverGlow on\n", .occlusion => "Occlusion on\n", + .parallax => "Parallax on\n", }, .shell => "Shell requested (new panes) fish\n", .tagline_size => "TaglineSize 73\n", diff --git a/src/detached/wire.zig b/src/detached/wire.zig index 3a914e42..6903a1e8 100644 --- a/src/detached/wire.zig +++ b/src/detached/wire.zig @@ -270,6 +270,7 @@ pub const Frame = struct { region.notice = try r.getByte(); region.clip = try r.getU16(); region.lift = @bitCast(try r.getU32()); + region.line = @bitCast(try r.getU32()); // A springy flavour overshoots, and a wind-up dips below. if (!(region.lift >= -1 and region.lift <= 2)) return error.BadValue; if (region.rect.x > f.cols or region.rect.w > f.cols - region.rect.x or @@ -754,7 +755,7 @@ pub fn layersBound(layers: []const pardes.Layer, tags: []const pardes.Layer, reg return n + regions.len * region_len + chrome_len; } -const region_len = 1 + 1 + 4 + 8 + 1 + 2 + 2 + 1 + 2 + 4; +const region_len = 1 + 1 + 4 + 8 + 1 + 2 + 2 + 1 + 2 + 4 + 4; /// The palette: each colour three bytes, a theme's optional ones a flag /// before them. const chrome_len = @typeInfo(pardes.Chrome).@"struct".fields.len * 4 + 8 * 4; @@ -839,6 +840,7 @@ pub fn encodeFrameLayers(out: []u8, cols: u16, rows: u16, cursor: ?Cursor, point try w.putByte(region.notice); try w.putU16(region.clip); try w.putU32(@bitCast(region.lift)); + try w.putU32(@bitCast(region.line)); } inline for (@typeInfo(pardes.Chrome).@"struct".fields) |field| { const rgb = @field(chrome, field.name); diff --git a/src/draw.zig b/src/draw.zig index 027326fa..aef93f51 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -63,7 +63,8 @@ pub fn place(p: *Pardes, s: *Surface) void { // A folded pane is its tag rows and nothing else. if (pane.collapsed) continue; const body_h = r.h -| pane.tag_rows; - s.addRegion(.{ .kind = .body, .owner = owner, .serial = pane.serial, .active = active, .rect = .{ .x = r.x + config.GUTTER, .y = body_y, .w = r.w - config.GUTTER, .h = body_h } }); + const line: i32 = if (pane.file) |f| @intCast(@min(f.scroll, std.math.maxInt(i32))) else if (pane.isTerminal()) panes.Terminal.gridOffset(pane) else 0; + s.addRegion(.{ .kind = .body, .owner = owner, .serial = pane.serial, .active = active, .line = line, .rect = .{ .x = r.x + config.GUTTER, .y = body_y, .w = r.w - config.GUTTER, .h = body_h } }); var rail: Region = .{ .kind = .rail, .owner = owner, .serial = pane.serial, .active = active, .rect = .{ .x = r.x, .y = body_y, .w = config.GUTTER, .h = body_h } }; // An image's rail has no thumb; a native PDF's is measured as its // pages are placed (Pdf.draw); every other pane's is here. @@ -472,7 +473,7 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { .rail_px = @intCast(@min(255, @as(u32, p.theme().rail_px orelse 12) * p.settings.grip_width / 100)), .name_ink = chrome.tag_name_fg, .active_name_ink = if (p.settings.focus_tint) chrome.tag_active_name_fg else chrome.tag_name_fg, - .fx = @as(u8, @intFromBool(p.settings.selection_glow)) | @as(u8, @intFromBool(p.settings.hover_glow)) << 1 | @as(u8, @intFromBool(p.settings.occlusion)) << 2, + .fx = @as(u8, @intFromBool(p.settings.selection_glow)) | @as(u8, @intFromBool(p.settings.hover_glow)) << 1 | @as(u8, @intFromBool(p.settings.occlusion)) << 2 | @as(u8, @intFromBool(p.settings.parallax)) << 3, }; if (p.theme().decor) |decor| { s.chrome.decor_dots = decor.page_dots; diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 8d9c29ab..dc58ee3f 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -5827,6 +5827,17 @@ fn renderFrame( if (surface.chrome.fx & 2 == 0 or surface.panelTracks().len != 0) g.hover_glow = .{ .now_ns = g.sel_glow.now_ns }; if (g.glide.moving()) g.glide.offset = g.glide.spring.value(g.glide.now_ns); cell_decor = CellDecor.of(chrome); + // G13: a body's dots follow its text at a quarter of its speed: its + // first line, and a glide's picture offset, in rows. + if (chrome.fx & 8 != 0 and chrome.decor_dots != null) for (surface.regionList()) |region| { + if (region.kind != .body or cell_decor.nbodies == cell_decor.bodies.len) continue; + var rows: f32 = @floatFromInt(region.line); + if (g.glide.moving() and g.glide.pane == region.owner) rows += g.glide.offset; + const period = cell_decor.uniforms[4]; + cell_decor.bodies[cell_decor.nbodies] = bodyPixels(region, layout); + cell_decor.shifts[cell_decor.nbodies] = @mod(-rows * layout.h * 0.25, period); + cell_decor.nbodies += 1; + }; // Plaques need an opaque window: with WindowOpacity under 100 the cells // are drawn as they are, and the plaques not at all. cell_decor.plaques_off = backgroundOpacity(g.applied_window_opacity) < 1; @@ -7004,7 +7015,13 @@ fn emitInstance( (cell_decor.inPlaque(px0 + 0.5, py0 + 0.5) or cell_decor.inPlaque(px0 + layout.w - 0.5, py0 + 0.5))) instances[idx].effect |= clear_bg_bit; if (cell_decor.dots) |dotted| { - if (!resolved.clear_bg and std.mem.eql(u8, &resolved.bg, &dotted)) instances[idx].effect |= dotted_bit; + if (!resolved.clear_bg and std.mem.eql(u8, &resolved.bg, &dotted)) { + instances[idx].effect |= dotted_bit; + // G13: the dots under a body move with its text, a quarter + // as far; the serial slot carries it (the shader reads it + // as the dots' offset alone). + instances[idx].serial = @bitCast(cell_decor.parallaxAt(px0 + 0.5, py0 + 0.5)); + } } if (cell_decor.title) |inks| { if (resolved.role == .tagline and (std.mem.eql(u8, &resolved.fg, &inks[0]) or std.mem.eql(u8, &resolved.fg, &inks[1]))) instances[idx].effect |= title_bit; @@ -8954,6 +8971,17 @@ const CellDecor = struct { grounds: [2][3]u8 = .{ .{ 0, 0, 0 }, .{ 0, 0, 0 } }, plaques_off: bool = false, + /// G13: each body's rectangle and how far its dots have moved. + bodies: [pardes.MAX_PANES][4]f32 = undefined, + shifts: [pardes.MAX_PANES]f32 = undefined, + nbodies: usize = 0, + + fn parallaxAt(decor: *const CellDecor, x: f32, y: f32) f32 { + for (decor.bodies[0..decor.nbodies], decor.shifts[0..decor.nbodies]) |band, shift| + if (x >= band[0] and x < band[2] and y >= band[1] and y < band[3]) return shift; + return 0; + } + fn inPlaque(decor: *const CellDecor, x: f32, y: f32) bool { for (decor.plaques[0..decor.nplaques]) |band| if (x >= band[0] and x < band[2] and y >= band[1] and y < band[3]) return true; @@ -9740,6 +9768,33 @@ test "occlusion shades each body's edges, inside it, never a tag, a grip or the try std.testing.expect(shades >= 4); } +test "a body tells its first line, and lapis's dots under it move a quarter as far" { + const gpa = std.testing.allocator; + const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); + defer core.deinit(); + const pane = try core.setTestFile("line\n" ** 80); + pane.scrollBy(8); + try std.testing.expect(core.executeBuiltinLine(0, "Theme lapis")); + core.settings.parallax = true; + for (0..40) |_| core.update(.tick); + pardes.test_api.sync(core); + const s = try core.render(core.scratch.allocator()); + const body = for (s.regionList()) |region| { + if (region.kind == .body) break region; + } else return error.NoBody; + try std.testing.expectEqual(@as(i32, 8), body.line); + try std.testing.expect(s.chrome.fx & 8 != 0); + // The shift the cell shader is handed: a quarter of 8 rows of 20 px, + // upward, within the dots' period. + var decor = CellDecor.of(&s.chrome); + const period = decor.uniforms[4]; + decor.bodies[0] = .{ 0, 0, 800, 480 }; + decor.shifts[0] = @mod(-8.0 * 20.0 * 0.25, period); + decor.nbodies = 1; + try std.testing.expectApproxEqAbs(@mod(-40.0, period), decor.parallaxAt(10, 10), 1e-4); + try std.testing.expectEqual(@as(f32, 0), decor.parallaxAt(900, 10)); +} + /// What a bundled post pass leaves alone (Post.Frame.spare), in window /// pixels: every tag with its grip, the column and workspace tags, and the /// notices, the chrome the focus indicators live in. A grip, the gap after diff --git a/src/surface.zig b/src/surface.zig index 02e4bb5d..d1ea78b1 100644 --- a/src/surface.zig +++ b/src/surface.zig @@ -370,6 +370,10 @@ pub const Region = struct { /// focus (Lift, on a spring), a notice's while Lift is on. A pixel shell /// casts a soft shadow from it; the tier it is drawn in never changes. lift: f32 = 0, + /// A body's view: the first line it shows (a file's scroll, a + /// terminal's grid offset), for what a pixel shell moves with the text + /// (G13's parallax). + line: i32 = 0, /// Cells the column-move rail takes off the right edge while it runs /// there: layers and pixel shells stop short of them, the grid does not. clip: u16 = 0, @@ -451,7 +455,7 @@ pub const Chrome = struct { /// A pixel shell's small effects: bit 0 a glow round the body's /// selection (G9, SelectionGlow), bit 1 one under the word a look-hover /// would open (G11, HoverGlow), bit 2 the bodies' edge shade (G12, - /// Occlusion). + /// Occlusion), bit 3 the page pattern's parallax (G13, Parallax). fx: u8 = 0, }; -- cgit v1.3 From 52f9c1423bc4e58079b008e763b5485ae49911f7 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 08:37:12 -0300 Subject: G14: Afterglow, changed text glows a moment and fades Afterglow on|off (off, a pixel shell's; Chrome.fx bit 4): the GUI keeps the grid it last drew and when each cell changed; a body cell whose text changed glows in the theme's accent, at most 18% and under the text's contrast floor, fading with an ease-out over 250 ms, one flat rectangle a run of cells that changed together; never a tag or a grip, the cursor or a selection; a scrolled body (its first line moved) starts over rather than lighting up whole. On the continuous path while anything glows. Tests: three changed cells glow as a run of two (the cursor's left out), gone by 250 ms, a scroll lights nothing. Gates as before; goldens byte-identical. Feel review: .scratch/render/afterglow/. --- docs/config.md | 2 + docs/effects.md | 10 ++++ src/config.zig | 12 +++-- src/draw.zig | 2 +- src/gui/gui.zig | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/surface.zig | 3 +- 6 files changed, 177 insertions(+), 6 deletions(-) (limited to 'docs/effects.md') diff --git a/docs/config.md b/docs/config.md index 97bf95a1..c66b124e 100644 --- a/docs/config.md +++ b/docs/config.md @@ -580,6 +580,8 @@ Occlusion on pane bodies darken faintly toward their edges (2%), never over the cursor Parallax on a theme's page pattern (lapis's dots) moves with the text at a quarter of its speed +Afterglow on text that changes glows for a moment in the theme's accent + and fades (250 ms), never on a tag, the cursor or a selection CursorBlink on the cursor blinks, solid while typing and half a second after, eased at each edge, solid after 10 idle seconds GripWidth 150 the grip's button and the scrollbar under it, percent of the diff --git a/docs/effects.md b/docs/effects.md index fbb44dfa..6a283e45 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -47,6 +47,7 @@ why. The verdict is the user's. | G11 look-hover glow | `HoverGlow on\|off` (off) | a soft underline of the theme's accent under the word a look-hover would open, fading in over 80 ms | .scratch/render/hover/ (forge, acme, lapis; zooms) | pending | | G12 ambient occlusion | `Occlusion on\|off` (off) | pane bodies darken toward their edges, at most 2% (§9.1: 1 to 2%) | .scratch/render/occlusion/ (on/off on forge, acme, lapis; acme-diff-x40.png) | pending | | G13 parallax | `Parallax on\|off` (off) | a theme's page pattern under the bodies (lapis's dots) moves with the text at a quarter of its speed, glides included | .scratch/render/parallax/ (lapis, notches down and up) | pending | +| G14 afterglow | `Afterglow on\|off` (off) | a body cell whose text changed glows in the accent at 18% and fades over 250 ms | .scratch/render/afterglow/ (forge, acme: two in-place edits) | pending | ## Motion flavours @@ -237,3 +238,12 @@ so they drift with the text as it glides and settle with it (measured: 4 lines at 35 px move the 22 px grid 13 px, 35 mod 22). The cell shader reads the offset from the instance's serial slot, free since G7 took the dissolve's per-cell noise out. Without a pattern, nothing happens. + +Notes on G14: the GUI keeps the grid it last drew and when each cell last +changed; a changed cell of a pane body glows in the theme's accent, 18% at +most and under the text's contrast floor, and fades with an ease-out over +250 ms, drawn as one flat rectangle a run of cells that changed together. +Never on a tag or a grip (bodies only), the cursor's cell or a selection; +a body whose first line moved (a scroll) starts over instead of lighting +up whole. It runs on the continuous path while anything glows, and costs +a compare of the grid a frame while on, nothing while off. diff --git a/src/config.zig b/src/config.zig index d11cbe76..2a764118 100644 --- a/src/config.zig +++ b/src/config.zig @@ -126,6 +126,7 @@ pub const leader_path = paths: { if (builtins.capabilities.lift) table.set(.HoverGlow, null); if (builtins.capabilities.lift) table.set(.Occlusion, null); if (builtins.capabilities.lift) table.set(.Parallax, null); + if (builtins.capabilities.lift) table.set(.Afterglow, null); if (builtins.capabilities.lift) table.set(.Lift, null); table.set(.Motion, null); table.set(.InactiveDim, null); @@ -682,6 +683,9 @@ pub const Runtime = struct { /// G13: a theme's page pattern under the bodies (lapis's dots) moves /// with the text at a quarter of its speed, a pixel shell's. parallax: bool = false, + /// G14: text that changes glows for a moment in the theme's accent and + /// fades, a pixel shell's. + afterglow: bool = false, /// How long a message stays after the key or click that dismisses it. message_linger_ms: u16 = 800, /// How long its fall into the row takes, easing out (§8.1: arriving, @@ -905,7 +909,7 @@ pub const Runtime = struct { /// The message timings a setting word sets, each in milliseconds. pub const MessageTime = enum { linger, fall, dissolve }; - pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax }; + pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax, afterglow }; /// A bundled post pass, a Shadertoy file in shaders/post/: the CRT, and /// G4's bloom, vignette and grain (docs/effects.md). pub const Scene = enum { crt, bloom, vignette, grain }; @@ -968,6 +972,7 @@ pub const Runtime = struct { .{ .word = "HoverGlow", .action = .{ .toggle = .hover_glow }, .availability = .lift, .doc = "A soft underline of light under the word a look-hover would open, on or off." }, .{ .word = "Occlusion", .action = .{ .toggle = .occlusion }, .availability = .lift, .doc = "Pane bodies darken faintly toward their edges, on or off." }, .{ .word = "Parallax", .action = .{ .toggle = .parallax }, .availability = .lift, .doc = "A theme's page pattern moves with the text at a quarter of its speed, on or off." }, + .{ .word = "Afterglow", .action = .{ .toggle = .afterglow }, .availability = .lift, .doc = "Text that changes glows for a moment and fades, on or off." }, .{ .word = "Lift", .action = .lift, .availability = .lift, .doc = "How the focused pane stands off the page: off, shadow, rim or auto." }, .{ .word = "Motion", .action = .motion, .doc = "How animations move: off, crisp, smooth, bouncy or playful." }, .{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." }, @@ -1044,9 +1049,9 @@ pub const Runtime = struct { .toggle => |field| if (field == .ligatures) { if (setting.availability != .ligatures) @compileError("the ligatures toggle must use the ligatures capability"); - } else if (field == .cursor_blink or field == .selection_glow or field == .hover_glow or field == .occlusion or field == .parallax) { + } else if (field == .cursor_blink or field == .selection_glow or field == .hover_glow or field == .occlusion or field == .parallax or field == .afterglow) { if (setting.availability != .lift) - @compileError("CursorBlink, SelectionGlow, HoverGlow, Occlusion and Parallax must use the lift capability (a pixel shell's)"); + @compileError("CursorBlink, SelectionGlow, HoverGlow, Occlusion, Parallax and Afterglow must use the lift capability (a pixel shell's)"); } else if (setting.availability != null) @compileError("unconditional toggles cannot carry a backend capability"), else => if (setting.availability != null) @@ -1705,6 +1710,7 @@ pub const Runtime = struct { .hover_glow => "HoverGlow on\n", .occlusion => "Occlusion on\n", .parallax => "Parallax on\n", + .afterglow => "Afterglow on\n", }, .shell => "Shell requested (new panes) fish\n", .tagline_size => "TaglineSize 73\n", diff --git a/src/draw.zig b/src/draw.zig index aef93f51..93d5b2d9 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -473,7 +473,7 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { .rail_px = @intCast(@min(255, @as(u32, p.theme().rail_px orelse 12) * p.settings.grip_width / 100)), .name_ink = chrome.tag_name_fg, .active_name_ink = if (p.settings.focus_tint) chrome.tag_active_name_fg else chrome.tag_name_fg, - .fx = @as(u8, @intFromBool(p.settings.selection_glow)) | @as(u8, @intFromBool(p.settings.hover_glow)) << 1 | @as(u8, @intFromBool(p.settings.occlusion)) << 2 | @as(u8, @intFromBool(p.settings.parallax)) << 3, + .fx = @as(u8, @intFromBool(p.settings.selection_glow)) | @as(u8, @intFromBool(p.settings.hover_glow)) << 1 | @as(u8, @intFromBool(p.settings.occlusion)) << 2 | @as(u8, @intFromBool(p.settings.parallax)) << 3 | @as(u8, @intFromBool(p.settings.afterglow)) << 4, }; if (p.theme().decor) |decor| { s.chrome.decor_dots = decor.page_dots; diff --git a/src/gui/gui.zig b/src/gui/gui.zig index dc58ee3f..b631a1cb 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -1874,6 +1874,8 @@ const Gui = struct { /// last drawn, for their fade-in. sel_glow: SelGlow = .{}, hover_glow: SelGlow = .{}, + /// G14: the cells last drawn and when each last changed. + afterglow: Afterglow = .{}, /// The cursor's blink (blinkNow): when the frame drawn last arrived, /// a redraw owed for an edge, and this frame's cursor mode and alpha. @@ -2583,6 +2585,7 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u defer c.ui_font_free(g.font); defer gpa.free(g.scroll_edge); // grown on demand by stepScroll defer g.glide.deinit(gpa); + defer g.afterglow.deinit(gpa); resetGlyphAtlas(&g); if (attach) |requested| return attachRequested(gpa, &g, requested); @@ -4997,7 +5000,7 @@ fn stepGlide(g: *Gui, core: *pardes.Pardes, gpa: std.mem.Allocator) void { const glide = &g.glide; // The glide runs on the core's continuous path: frames every loop, and // a virtual clock carried on. - defer core.shell_continuous = glide.moving() or g.sel_glow.fading or g.hover_glow.fading; + defer core.shell_continuous = glide.moving() or g.sel_glow.fading or g.hover_glow.fading or g.afterglow.glowing; glide.now_ns = core.now_ns; glide.motion = pardes.animation.Motion.of(core.settings.motion); if (!glide.spring.settled) { @@ -5823,6 +5826,7 @@ fn renderFrame( g.sel_glow.now_ns = if (core) |p| p.now_ns else c.SDL_GetTicksNS(); // Off, or while panes move, no glow and nothing fading. if (surface.chrome.fx & 1 == 0 or surface.panelTracks().len != 0) g.sel_glow = .{ .now_ns = g.sel_glow.now_ns }; + if (surface.chrome.fx & 16 == 0) g.afterglow.glowing = false; g.hover_glow.now_ns = g.sel_glow.now_ns; if (surface.chrome.fx & 2 == 0 or surface.panelTracks().len != 0) g.hover_glow = .{ .now_ns = g.sel_glow.now_ns }; if (g.glide.moving()) g.glide.offset = g.glide.spring.value(g.glide.now_ns); @@ -8761,6 +8765,8 @@ fn buildDecor(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface, g if (index == 0 and groups.tracks == 0 and chrome.fx & 1 != 0) try glowBlocks(g, gpa, surface, .selection, layout, win_w, win_h); // G11: a glow under the word a look-hover would open. if (index == 0 and groups.tracks == 0 and chrome.fx & 2 != 0) try glowBlocks(g, gpa, surface, .hover, layout, win_w, win_h); + // G14: what changed glows, while nothing moves. + if (index == 0 and groups.tracks == 0 and chrome.fx & 16 != 0) try afterglowDecor(g, gpa, surface, layout, win_w, win_h); // G12: the bodies' edges shaded, a pane's in its own group. if (chrome.fx & 4 != 0) try occlusion(g, gpa, placed, groups, index, surface, ceilings, layout, win_w, win_h, track); // A single spine runs down each column, through every tag and body. @@ -9193,6 +9199,91 @@ fn occlusion(g: *Gui, gpa: std.mem.Allocator, regions: []const pardes.Region, gr } } +/// G14's state: the grid last drawn, when each cell last changed, and each +/// body's line then (a scroll changes every cell and is not a change). +const Afterglow = struct { + cells: []pardes.Cell = &.{}, + changed: []u64 = &.{}, + cols: u16 = 0, + rows: u16 = 0, + lines: [pardes.MAX_PANES]i32 = @splat(std.math.minInt(i32)), + /// A cell still glows: the core keeps frames coming. + glowing: bool = false, + + fn deinit(glow: *Afterglow, gpa: std.mem.Allocator) void { + gpa.free(glow.cells); + gpa.free(glow.changed); + } +}; + +const afterglow_ns: u64 = 250 * std.time.ns_per_ms; + +/// G14: a cell of a pane body whose text changed since the last frame +/// glows in the theme's accent at 18% and fades out over 250 ms with an +/// ease-out, as a run of cells a row. Never on a tag or a grip (bodies +/// only), the cursor or a selection; a body whose view moved (a scroll) +/// starts over rather than lighting up whole. +fn afterglowDecor(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface, layout: CellLayout, win_w: f32, win_h: f32) !void { + const glow = &g.afterglow; + const now = g.sel_glow.now_ns; + const n = @as(usize, surface.cols) * surface.rows; + const fresh = glow.cols != surface.cols or glow.rows != surface.rows or glow.cells.len != n; + if (fresh) { + glow.cells = try gpa.realloc(glow.cells, n); + glow.changed = try gpa.realloc(glow.changed, n); + @memcpy(glow.cells, surface.cells); + @memset(glow.changed, 0); + glow.cols = surface.cols; + glow.rows = surface.rows; + } + const chrome = &surface.chrome; + const page = chrome.page orelse bg_default; + const fg = chrome.fg orelse fg_default; + const cap = @min(0.18, lightenCeiling(fg, page, chrome.accent)); + var glowing = false; + for (surface.regionList()) |body| { + if (body.kind != .body or body.owner >= glow.lines.len) continue; + const scrolled = glow.lines[body.owner] != body.line; + glow.lines[body.owner] = body.line; + var row = body.rect.y; + while (row < body.rect.y + body.rect.h and row < surface.rows) : (row += 1) { + var run_start: ?u16 = null; + var run_age: u64 = 0; + var col = body.rect.x; + while (col <= body.rect.x + body.rect.w and col <= surface.cols) : (col += 1) { + var age: ?u64 = null; + if (col < body.rect.x + body.rect.w and col < surface.cols) { + const at = @as(usize, row) * surface.cols + col; + const cell = surface.cells[at]; + const differs = !std.meta.eql(cell.style, glow.cells[at].style) or !std.mem.eql(u8, cell.grapheme(), glow.cells[at].grapheme()) or cell.default != glow.cells[at].default; + if (differs and !fresh) glow.changed[at] = if (scrolled) 0 else now; + const selected = !cell.default and switch (cell.style.bg) { + .rgb => |rgb| std.mem.eql(u8, &rgb, &chrome.sel_bg), + else => false, + }; + const cursor_here = if (surface.cursor) |cu| cu.x == col and cu.y == row else false; + const since = now -| glow.changed[at]; + if (glow.changed[at] != 0 and since < afterglow_ns and !selected and !cursor_here) age = since; + } + // A run is cells that changed together. + if (run_start) |start| if (age == null or age.? != run_age) { + const t = @as(f32, @floatFromInt(run_age)) / @as(f32, @floatFromInt(afterglow_ns)); + const fade = (1 - t) * (1 - t) * (1 - t); + try addDecor(g, gpa, @as(f32, @floatFromInt(start)) * layout.w, @as(f32, @floatFromInt(row)) * layout.h, @as(f32, @floatFromInt(col)) * layout.w, @as(f32, @floatFromInt(row + 1)) * layout.h, chrome.accent, cap * fade, null, win_w, win_h); + glowing = true; + run_start = null; + }; + if (age) |a| if (run_start == null) { + run_start = col; + run_age = a; + }; + } + } + } + @memcpy(glow.cells, surface.cells); + glow.glowing = glowing; +} + /// A theme's tag plaques (Chrome.decor_box_*), drawn under the cells of /// group `index`: each pane tag, and with the still panes the column and /// workspace tags, becomes a framed box inside its own band with a hard @@ -9795,6 +9886,67 @@ test "a body tells its first line, and lapis's dots under it move a quarter as f try std.testing.expectEqual(@as(f32, 0), decor.parallaxAt(900, 10)); } +test "changed text glows and fades in 250 ms; the cursor and a scroll do not light up" { + const gpa = std.testing.allocator; + const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); + defer core.deinit(); + const pane = try core.setTestFile("line\n" ** 60); + core.settings.afterglow = true; + pardes.test_api.sync(core); + const s = try core.render(core.scratch.allocator()); + const body = for (s.regionList()) |region| { + if (region.kind == .body) break region; + } else return error.NoBody; + s.cursor = .{ .x = body.rect.x + 12, .y = body.rect.y + 2 }; + var g: Gui = undefined; + g.decor = .empty; + defer g.decor.deinit(gpa); + g.cell_w = 10; + g.cell_h = 20; + g.afterglow = .{}; + defer g.afterglow.deinit(gpa); + const layout = fixedCellLayout(&g); + const Count = struct { + fn glows(items: []const CellInstance, accent: [3]u8) usize { + var n: usize = 0; + for (items) |item| { + const rgb: [3]u8 = .{ @intFromFloat(@round(item.br * 255)), @intFromFloat(@round(item.bg * 255)), @intFromFloat(@round(item.bb * 255)) }; + if (std.mem.eql(u8, &rgb, &accent) and item.fr > 0.001) n += 1; + } + return n; + } + }; + g.sel_glow = .{ .now_ns = std.time.ns_per_s }; + try afterglowDecor(&g, gpa, s, layout, 800, 480); + try std.testing.expectEqual(@as(usize, 0), g.decor.items.len); + // Three cells of a row change, the cursor's among them. + for (10..13) |x| { + const cell = &s.cells[@as(usize, body.rect.y + 2) * s.cols + body.rect.x + x]; + cell.* = .{ .default = false, .style = .{ .fg = .{ .rgb = .{ 1, 2, 3 } } } }; + cell.text[0] = 'X'; + cell.len = 1; + } + g.sel_glow.now_ns += 16 * std.time.ns_per_ms; + try afterglowDecor(&g, gpa, s, layout, 800, 480); + try std.testing.expectEqual(@as(usize, 1), Count.glows(g.decor.items, s.chrome.accent)); + const lit = g.decor.items[0]; + // Two cells wide: the cursor's is left out. + try std.testing.expectApproxEqAbs(@as(f32, 2 * 10 * 2.0 / 800.0), lit.x1 - lit.x0, 1e-4); + try std.testing.expect(g.afterglow.glowing); + // Gone by 250 ms. + g.decor.clearRetainingCapacity(); + g.sel_glow.now_ns += 260 * std.time.ns_per_ms; + try afterglowDecor(&g, gpa, s, layout, 800, 480); + try std.testing.expectEqual(@as(usize, 0), g.decor.items.len); + try std.testing.expect(!g.afterglow.glowing); + // A scroll changes every cell and lights none. + pane.scrollBy(5); + const scrolled = try core.render(core.scratch.allocator()); + g.sel_glow.now_ns += 16 * std.time.ns_per_ms; + try afterglowDecor(&g, gpa, scrolled, layout, 800, 480); + try std.testing.expectEqual(@as(usize, 0), g.decor.items.len); +} + /// What a bundled post pass leaves alone (Post.Frame.spare), in window /// pixels: every tag with its grip, the column and workspace tags, and the /// notices, the chrome the focus indicators live in. A grip, the gap after diff --git a/src/surface.zig b/src/surface.zig index d1ea78b1..22a71a27 100644 --- a/src/surface.zig +++ b/src/surface.zig @@ -455,7 +455,8 @@ pub const Chrome = struct { /// A pixel shell's small effects: bit 0 a glow round the body's /// selection (G9, SelectionGlow), bit 1 one under the word a look-hover /// would open (G11, HoverGlow), bit 2 the bodies' edge shade (G12, - /// Occlusion), bit 3 the page pattern's parallax (G13, Parallax). + /// Occlusion), bit 3 the page pattern's parallax (G13, Parallax), bit 4 + /// changed text's afterglow (G14, Afterglow). fx: u8 = 0, }; -- cgit v1.3 From bdb4da01c555337fe08167e420b06a3e3f5548ff Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 08:45:01 -0300 Subject: T2: JumpTrail, a terminal cursor's jump leaves a short fading trail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JumpTrail on|off (off; the tty shell's, §9.2 T2): a jump of three cells or more leaves three to five cells of trail behind the cursor along its path, their ground mixed toward the text's colour in OKLab (most beside the cursor), fading out over 120 ms. Truecolor terminals only (vaxis's answer, or COLORTERM truecolor/24bit); never the cursor's own cell, a selection or anything outside the focused pane's body; none under Motion off. It rides the continuous path (Pardes.shell_continuous) while it lasts; a few cells of output a frame. docs/effects.md opens the terminal track with the audit under decision 2 (keep and polish, remove nothing). Tests: a ten-cell jump lights 3 to 5 cells behind the cursor on its row, gone by 120 ms; a one-cell step and a terminal without truecolor light none. Feel review: .scratch/render/tty/trail/ (a real tty session replayed through pyte at 60 fps). --- docs/config.md | 3 ++ docs/effects.md | 17 +++++++ src/config.zig | 8 +++- src/tty/tty.zig | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 164 insertions(+), 2 deletions(-) (limited to 'docs/effects.md') diff --git a/docs/config.md b/docs/config.md index c66b124e..1d83bd8e 100644 --- a/docs/config.md +++ b/docs/config.md @@ -582,6 +582,9 @@ Parallax on a theme's page pattern (lapis's dots) moves with the text at a quarter of its speed Afterglow on text that changes glows for a moment in the theme's accent and fades (250 ms), never on a tag, the cursor or a selection +JumpTrail on in a terminal, a jump of the cursor of three cells or more + leaves a trail of a few cells that fades in 120 ms + (truecolor terminals; a pixel shell glides instead) CursorBlink on the cursor blinks, solid while typing and half a second after, eased at each edge, solid after 10 idle seconds GripWidth 150 the grip's button and the scrollbar under it, percent of the diff --git a/docs/effects.md b/docs/effects.md index 6a283e45..02602a23 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -247,3 +247,20 @@ Never on a tag or a grip (bodies only), the cursor's cell or a selection; a body whose first line moved (a scroll) starts over instead of lighting up whole. It runs on the continuous path while anything glows, and costs a compare of the grid a frame while on, nothing while off. + +## Terminal track (§9.2) + +Audit, after decision 2 (keep every whimsical effect and polish it, never +remove it): the six core-composed character transitions (ascii, edges, +fall, wave, scramble, typewriter) and curtain stay as they are, each +bounded to its pane's final rectangle and each cell's last sample its +canonical one; slide and vertical are the tty compositor's and follow the +Motion flavour (sxrrwplk); zoom stays (nearest-cell scaling, its look is +the effect); dissolve swaps each changed cell once at its threshold; +message fades and the theme's chrome fade are the core's (the latter in +OKLab since G10), and InactiveDim (T5's unfocused dim) works in a grid as +it does in a pixel shell. + +| # | effect | switch | state | review material | verdict | +|---|---|---|---|---|---| +| T2 | cursor jump trail | `JumpTrail on\|off` (off) | a jump of three cells or more leaves 3 to 5 cells of trail behind the cursor, their ground drawn toward the text's colour in OKLab, most beside it, fading in 120 ms; truecolor terminals (vaxis's answer or COLORTERM); never the cursor's cell, a selection or outside the focused body; off under Motion off; a few cells a frame | .scratch/render/tty/trail/ (pyte replay of a real tty session at 60 fps: trail-forge.mp4, zooms) | pending | diff --git a/src/config.zig b/src/config.zig index 2a764118..c0266e40 100644 --- a/src/config.zig +++ b/src/config.zig @@ -127,6 +127,7 @@ pub const leader_path = paths: { if (builtins.capabilities.lift) table.set(.Occlusion, null); if (builtins.capabilities.lift) table.set(.Parallax, null); if (builtins.capabilities.lift) table.set(.Afterglow, null); + table.set(.JumpTrail, null); if (builtins.capabilities.lift) table.set(.Lift, null); table.set(.Motion, null); table.set(.InactiveDim, null); @@ -686,6 +687,9 @@ pub const Runtime = struct { /// G14: text that changes glows for a moment in the theme's accent and /// fades, a pixel shell's. afterglow: bool = false, + /// T2: in a terminal, a jump of the cursor leaves a short trail that + /// fades in 120 ms (a truecolor terminal's; a pixel shell glides). + jump_trail: bool = false, /// How long a message stays after the key or click that dismisses it. message_linger_ms: u16 = 800, /// How long its fall into the row takes, easing out (§8.1: arriving, @@ -909,7 +913,7 @@ pub const Runtime = struct { /// The message timings a setting word sets, each in milliseconds. pub const MessageTime = enum { linger, fall, dissolve }; - pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax, afterglow }; + pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax, afterglow, jump_trail }; /// A bundled post pass, a Shadertoy file in shaders/post/: the CRT, and /// G4's bloom, vignette and grain (docs/effects.md). pub const Scene = enum { crt, bloom, vignette, grain }; @@ -973,6 +977,7 @@ pub const Runtime = struct { .{ .word = "Occlusion", .action = .{ .toggle = .occlusion }, .availability = .lift, .doc = "Pane bodies darken faintly toward their edges, on or off." }, .{ .word = "Parallax", .action = .{ .toggle = .parallax }, .availability = .lift, .doc = "A theme's page pattern moves with the text at a quarter of its speed, on or off." }, .{ .word = "Afterglow", .action = .{ .toggle = .afterglow }, .availability = .lift, .doc = "Text that changes glows for a moment and fades, on or off." }, + .{ .word = "JumpTrail", .action = .{ .toggle = .jump_trail }, .doc = "In a terminal, a jump of the cursor leaves a short trail that fades, on or off." }, .{ .word = "Lift", .action = .lift, .availability = .lift, .doc = "How the focused pane stands off the page: off, shadow, rim or auto." }, .{ .word = "Motion", .action = .motion, .doc = "How animations move: off, crisp, smooth, bouncy or playful." }, .{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." }, @@ -1711,6 +1716,7 @@ pub const Runtime = struct { .occlusion => "Occlusion on\n", .parallax => "Parallax on\n", .afterglow => "Afterglow on\n", + .jump_trail => "JumpTrail on\n", }, .shell => "Shell requested (new panes) fish\n", .tagline_size => "TaglineSize 73\n", diff --git a/src/tty/tty.zig b/src/tty/tty.zig index e7eddec4..8f07d7fc 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -914,6 +914,8 @@ const Shell = struct { check_files: bool = false, in_paste: bool = false, tracks: []const pardes.animation.Track = &.{}, + /// T2: the cursor's jump trail (JumpTrail). + trail: JumpTrail = .{}, /// PARDES_TEST_CLOCK's virtual time (host_io.testClock), and where the /// running-out wait moves it: the core's next wake. test_clock: ?u64 = null, @@ -1161,7 +1163,8 @@ const Shell = struct { ) catch return; const tz_cells = tracy.zone(@src(), "surface->vaxis"); const win = vx.window(); - paintCells(win, surface.cells, surface.cols, surface.rows); + const trailed = s.trail.apply(s.frame.allocator(), surface, s.core, vx.caps.rgb or colortermTruecolor()) catch surface; + paintCells(win, trailed.cells, trailed.cols, trailed.rows); tz_cells.end(); for (surface.images[0..surface.nimages]) |maybe| { const place = maybe orelse continue; @@ -1804,6 +1807,95 @@ fn paintCells(win: vaxis.Window, cells: []const pardes.Cell, cols: u16, rows: u1 } } +/// Truecolor by COLORTERM (truecolor or 24bit), for a terminal that does +/// not answer vaxis's query (§9.2: vaxis caps or COLORTERM). +fn colortermTruecolor() bool { + const value = std.mem.span(std.c.getenv("COLORTERM") orelse return false); + return std.mem.eql(u8, value, "truecolor") or std.mem.eql(u8, value, "24bit"); +} + +/// T2 (docs/render-pipeline.md §9.2): the cursor jumping three cells or +/// more leaves a trail of three to five cells along its path, just behind +/// it, their ground drawn toward the text's colour, most beside the +/// cursor, all fading out over 120 ms. Truecolor terminals only; a cell a +/// frame changes, a few bytes. Never the cursor's own cell, a selection or +/// anything outside the focused pane's body; off with Motion off. +const JumpTrail = struct { + last: ?[2]u16 = null, + from: [2]u16 = .{ 0, 0 }, + to: [2]u16 = .{ 0, 0 }, + start_ns: u64 = 0, + active: bool = false, + + const life_ns: u64 = 120 * std.time.ns_per_ms; + + fn apply(trail: *JumpTrail, arena: std.mem.Allocator, surface: *pardes.Surface, core: *pardes.Pardes, truecolor: bool) !*pardes.Surface { + defer core.shell_continuous = trail.active; + const on = core.settings.jump_trail and truecolor and core.settings.motion != .off; + const cursor = surface.cursor orelse { + trail.active = false; + return surface; + }; + const here: [2]u16 = .{ cursor.x, cursor.y }; + if (trail.last) |was| { + const dx = @as(i32, here[0]) - was[0]; + const dy = @as(i32, here[1]) - was[1]; + if (on and @max(@abs(dx), @abs(dy)) >= 3) { + trail.* = .{ .last = here, .from = was, .to = here, .start_ns = core.now_ns, .active = true }; + } + } + trail.last = here; + if (!on or !trail.active) { + trail.active = false; + return surface; + } + const age = core.now_ns -| trail.start_ns; + if (age >= life_ns or !std.meta.eql(trail.to, here)) { + trail.active = false; + return surface; + } + const out = try arena.create(pardes.Surface); + out.* = surface.*; + out.cells = try arena.dupe(pardes.Cell, surface.cells); + const theme = core.theme(); + const ink = theme.fg orelse .{ 0xcc, 0xcc, 0xcc }; + const page = theme.bg orelse pardes.colors.null_page; + const body = for (surface.regionList()) |region| { + if (region.kind == .body and region.owner == core.active) break region.rect; + } else return out; + const t = @as(f32, @floatFromInt(age)) / @as(f32, @floatFromInt(life_ns)); + const fade = (1 - t) * (1 - t); + const dx = @as(f32, @floatFromInt(@as(i32, trail.from[0]) - trail.to[0])); + const dy = @as(f32, @floatFromInt(@as(i32, trail.from[1]) - trail.to[1])); + const span = @max(@abs(dx), @abs(dy)); + const n: usize = @intFromFloat(std.math.clamp(@round(span / 4), 3, 5)); + var k: usize = 1; + var last_cell: ?[2]i32 = null; + var step: f32 = 1; + while (k <= n and step <= span) : (step += 1) { + const x: i32 = @intFromFloat(@round(@as(f32, @floatFromInt(trail.to[0])) + dx * step / span)); + const y: i32 = @intFromFloat(@round(@as(f32, @floatFromInt(trail.to[1])) + dy * step / span)); + if (last_cell) |seen| if (seen[0] == x and seen[1] == y) continue; + last_cell = .{ x, y }; + defer k += 1; + if (x < body.x or y < body.y or x >= @as(i32, body.x) + body.w or y >= @as(i32, body.y) + body.h) continue; + const cell = &out.cells[@as(usize, @intCast(y)) * out.cols + @as(usize, @intCast(x))]; + const ground: [3]u8 = if (cell.default) page else switch (cell.style.bg) { + .rgb => |rgb| rgb, + else => page, + }; + if (std.mem.eql(u8, &ground, &theme.sel_bg)) continue; + const strength = 0.55 * fade * (1 - @as(f32, @floatFromInt(k - 1)) / @as(f32, @floatFromInt(n))); + if (strength < 0.02) continue; + const was_default = cell.default; + cell.default = false; + if (was_default) cell.style = .{}; + cell.style.bg = .{ .rgb = pardes.colors.mixOklab(ground, ink, strength) }; + } + return out; + } +}; + fn paintCursor(win: vaxis.Window, x: u16, y: u16, bar: bool) void { win.showCursor(x, y); win.setCursorShape(if (bar) .beam else .default); @@ -2064,3 +2156,47 @@ fn attachSession(init: std.process.Init, name: []const u8, tty: *vaxis.Tty, vx: return attachLoop(&a); } + +test "a jump leaves a trail of a few cells behind the cursor that fades in 120 ms" { + const gpa = std.testing.allocator; + const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer core.deinit(); + _ = try core.setTestFile("some text on a line\n" ** 20); + try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); + core.settings.jump_trail = true; + for (0..40) |_| core.update(.tick); + core.sync(); + var arena: std.heap.ArenaAllocator = .init(gpa); + defer arena.deinit(); + const s = try core.render(arena.allocator()); + const body = for (s.regionList()) |region| { + if (region.kind == .body) break region.rect; + } else return error.NoBody; + var trail: JumpTrail = .{}; + core.now_ns = std.time.ns_per_s; + s.cursor = .{ .x = body.x + 2, .y = body.y + 1 }; + _ = try trail.apply(arena.allocator(), s, core, true); + // Ten cells right: a trail back toward where it was. + s.cursor = .{ .x = body.x + 12, .y = body.y + 1 }; + core.now_ns += 16 * std.time.ns_per_ms; + const lit = try trail.apply(arena.allocator(), s, core, true); + try std.testing.expect(trail.active and core.shell_continuous); + var changed: usize = 0; + for (lit.cells, s.cells, 0..) |a, b, i| { + if (std.meta.eql(a.style.bg, b.style.bg)) continue; + changed += 1; + // On the cursor's row, behind it, never its own cell. + try std.testing.expectEqual(@as(usize, body.y + 1), i / s.cols); + try std.testing.expect(i % s.cols < body.x + 12 and i % s.cols > body.x + 2); + } + try std.testing.expect(changed >= 3 and changed <= 5); + // Gone by 120 ms; a step of a cell leaves none; nor a terminal without + // truecolor. + core.now_ns += 130 * std.time.ns_per_ms; + const faded = try trail.apply(arena.allocator(), s, core, true); + try std.testing.expect(faded == s and !trail.active and !core.shell_continuous); + s.cursor = .{ .x = body.x + 13, .y = body.y + 1 }; + try std.testing.expect(try trail.apply(arena.allocator(), s, core, true) == s); + s.cursor = .{ .x = body.x + 2, .y = body.y + 1 }; + try std.testing.expect(try trail.apply(arena.allocator(), s, core, false) == s); +} -- cgit v1.3 From 137e784bb617438bec5079ec5fef4b16ce8b75fe Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 08:55:06 -0300 Subject: T4: the terminal's dissolve swaps cells in ordered (Bayer) order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit animation.dissolveRevealed (the tty compositor's dissolve and the pointer mapping that follows it) swaps each changed cell once at its place in a 4x4 Bayer matrix, shifted by the pane's serial so two panes differ, instead of at a hashed noise threshold: the new content comes in as an even patterned screen (§9.2 T4). Endpoints stay exact. Tests: a 4x4 block reveals exactly t x 16 cells at t = 1/4, 1/2, 3/4. Snapshots unchanged. Feel review: .scratch/render/tty/dissolve/ (the matrix over two real frames; the recorded session's pane did not animate, noted in docs/effects.md). --- docs/effects.md | 6 ++++++ src/animation.zig | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'docs/effects.md') diff --git a/docs/effects.md b/docs/effects.md index 02602a23..ac202579 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -264,3 +264,9 @@ it does in a pixel shell. | # | effect | switch | state | review material | verdict | |---|---|---|---|---|---| | T2 | cursor jump trail | `JumpTrail on\|off` (off) | a jump of three cells or more leaves 3 to 5 cells of trail behind the cursor, their ground drawn toward the text's colour in OKLab, most beside it, fading in 120 ms; truecolor terminals (vaxis's answer or COLORTERM); never the cursor's cell, a selection or outside the focused body; off under Motion off; a few cells a frame | .scratch/render/tty/trail/ (pyte replay of a real tty session at 60 fps: trail-forge.mp4, zooms) | pending | +| T4 ordered swap | `PanelDissolve` (off) | the terminal's dissolve swaps each changed cell once at its place in a 4x4 Bayer matrix (shifted per pane), an even patterned screen instead of noise; hit-testing follows the same order | .scratch/render/tty/dissolve/ (ordered-swap-sim: the matrix applied to two real frames; see note) | pending | + +Note on T4's material: a pane opening in a tty session recorded through +pyte did not animate (PanelSlide did not either there), so the review +material applies the same matrix to two real frames of that session; the +unit test holds the order (a 4x4 block reveals exactly t x 16 cells). diff --git a/src/animation.zig b/src/animation.zig index 713a8a30..b682c770 100644 --- a/src/animation.zig +++ b/src/animation.zig @@ -313,11 +313,18 @@ pub fn cellNoise(serial: u32, col: u16, row: u16) f32 { /// Whether a changed dissolve cell has crossed from the frozen old grid to /// the new one. Exact endpoints are part of the presentation contract. +/// T4 (§9.2): an ordered swap, each cell at its place in a 4x4 Bayer +/// matrix (shifted by the pane's serial so two panes differ), so the new +/// content comes in as an even, patterned screen rather than noise, and +/// each cell swaps once. pub fn dissolveRevealed(serial: u32, col: u16, row: u16, raw_progress: f32) bool { const t = std.math.clamp(raw_progress, 0.0, 1.0); if (t <= 0) return false; if (t >= 1) return true; - return cellNoise(serial, col, row) < t; + const bayer = [4][4]u8{ .{ 0, 8, 2, 10 }, .{ 12, 4, 14, 6 }, .{ 3, 11, 1, 9 }, .{ 15, 7, 13, 5 } }; + const x = (@as(u32, col) +% serial) % 4; + const y = (@as(u32, row) +% serial / 4) % 4; + return (@as(f32, @floatFromInt(bayer[y][x])) + 0.5) / 16 < t; } pub const CellArea = struct { @@ -624,6 +631,16 @@ test "opening presets separate geometry and content transitions" { try std.testing.expect(closing.amount() < progress(.vertical, closing.frame)); } +test "the ordered dissolve reveals a 4x4 block evenly, each cell once" { + for ([_]f32{ 0.25, 0.5, 0.75 }) |t| { + var revealed: usize = 0; + for (0..4) |y| for (0..4) |x| { + if (dissolveRevealed(7, @intCast(x), @intCast(y), t)) revealed += 1; + }; + try std.testing.expectEqual(@as(usize, @intFromFloat(t * 16)), revealed); + } +} + test "dissolve has exact stable endpoints" { for (0..64) |col| { const x: u16 = @intCast(col); -- cgit v1.3 From a544c0b1af65427f2186baaa5dff176bcd310915 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 08:59:20 -0300 Subject: T1: ChipShadow, a terminal's notice chips cast a cell's shadow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ChipShadow on|off (off; the tty shell's, §9.2 T1): each notice chip casts a shadow one cell right and one down inside its own pane's body: on a blank cell a half block (▌ right, ▀ below, ▘ at the corner) in a colour 35% darker than the ground (OKLab), so the shadow is half a cell thick; under text the ground itself darkened. Never the cursor's cell, a selection, a tag or another chip; truecolor terminals only. Tests: the shadow lies right of or below the chip, never in it; nothing with it off or without truecolor. Snapshots unchanged. Feel review: .scratch/render/tty/shadow/. --- docs/config.md | 2 ++ docs/effects.md | 1 + src/config.zig | 8 ++++- src/tty/tty.zig | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 113 insertions(+), 2 deletions(-) (limited to 'docs/effects.md') diff --git a/docs/config.md b/docs/config.md index 1d83bd8e..45677170 100644 --- a/docs/config.md +++ b/docs/config.md @@ -585,6 +585,8 @@ Afterglow on text that changes glows for a moment in the theme's accent JumpTrail on in a terminal, a jump of the cursor of three cells or more leaves a trail of a few cells that fades in 120 ms (truecolor terminals; a pixel shell glides instead) +ChipShadow on in a terminal, a notice chip casts a shadow a cell right and + down: half blocks on blank cells, a darker ground on text CursorBlink on the cursor blinks, solid while typing and half a second after, eased at each edge, solid after 10 idle seconds GripWidth 150 the grip's button and the scrollbar under it, percent of the diff --git a/docs/effects.md b/docs/effects.md index ac202579..c447b344 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -264,6 +264,7 @@ it does in a pixel shell. | # | effect | switch | state | review material | verdict | |---|---|---|---|---|---| | T2 | cursor jump trail | `JumpTrail on\|off` (off) | a jump of three cells or more leaves 3 to 5 cells of trail behind the cursor, their ground drawn toward the text's colour in OKLab, most beside it, fading in 120 ms; truecolor terminals (vaxis's answer or COLORTERM); never the cursor's cell, a selection or outside the focused body; off under Motion off; a few cells a frame | .scratch/render/tty/trail/ (pyte replay of a real tty session at 60 fps: trail-forge.mp4, zooms) | pending | +| T1 chip shadow | `ChipShadow on\|off` (off) | a notice chip casts a shadow a cell right and down in its body: half blocks (▌ ▀ ▘) in a darker ground on blank cells, the ground 35% darker (OKLab) under text; never the cursor, a selection, a tag or another chip; truecolor only | .scratch/render/tty/shadow/ (forge, acme; zooms) | pending | | T4 ordered swap | `PanelDissolve` (off) | the terminal's dissolve swaps each changed cell once at its place in a 4x4 Bayer matrix (shifted per pane), an even patterned screen instead of noise; hit-testing follows the same order | .scratch/render/tty/dissolve/ (ordered-swap-sim: the matrix applied to two real frames; see note) | pending | Note on T4's material: a pane opening in a tty session recorded through diff --git a/src/config.zig b/src/config.zig index c0266e40..316ed3a0 100644 --- a/src/config.zig +++ b/src/config.zig @@ -128,6 +128,7 @@ pub const leader_path = paths: { if (builtins.capabilities.lift) table.set(.Parallax, null); if (builtins.capabilities.lift) table.set(.Afterglow, null); table.set(.JumpTrail, null); + table.set(.ChipShadow, null); if (builtins.capabilities.lift) table.set(.Lift, null); table.set(.Motion, null); table.set(.InactiveDim, null); @@ -690,6 +691,9 @@ pub const Runtime = struct { /// T2: in a terminal, a jump of the cursor leaves a short trail that /// fades in 120 ms (a truecolor terminal's; a pixel shell glides). jump_trail: bool = false, + /// T1: in a terminal, a notice chip casts a cell's shadow right and + /// down (truecolor terminals). + chip_shadow: bool = false, /// How long a message stays after the key or click that dismisses it. message_linger_ms: u16 = 800, /// How long its fall into the row takes, easing out (§8.1: arriving, @@ -913,7 +917,7 @@ pub const Runtime = struct { /// The message timings a setting word sets, each in milliseconds. pub const MessageTime = enum { linger, fall, dissolve }; - pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax, afterglow, jump_trail }; + pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax, afterglow, jump_trail, chip_shadow }; /// A bundled post pass, a Shadertoy file in shaders/post/: the CRT, and /// G4's bloom, vignette and grain (docs/effects.md). pub const Scene = enum { crt, bloom, vignette, grain }; @@ -978,6 +982,7 @@ pub const Runtime = struct { .{ .word = "Parallax", .action = .{ .toggle = .parallax }, .availability = .lift, .doc = "A theme's page pattern moves with the text at a quarter of its speed, on or off." }, .{ .word = "Afterglow", .action = .{ .toggle = .afterglow }, .availability = .lift, .doc = "Text that changes glows for a moment and fades, on or off." }, .{ .word = "JumpTrail", .action = .{ .toggle = .jump_trail }, .doc = "In a terminal, a jump of the cursor leaves a short trail that fades, on or off." }, + .{ .word = "ChipShadow", .action = .{ .toggle = .chip_shadow }, .doc = "In a terminal, a notice chip casts a cell's shadow right and down, on or off." }, .{ .word = "Lift", .action = .lift, .availability = .lift, .doc = "How the focused pane stands off the page: off, shadow, rim or auto." }, .{ .word = "Motion", .action = .motion, .doc = "How animations move: off, crisp, smooth, bouncy or playful." }, .{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." }, @@ -1717,6 +1722,7 @@ pub const Runtime = struct { .parallax => "Parallax on\n", .afterglow => "Afterglow on\n", .jump_trail => "JumpTrail on\n", + .chip_shadow => "ChipShadow on\n", }, .shell => "Shell requested (new panes) fish\n", .tagline_size => "TaglineSize 73\n", diff --git a/src/tty/tty.zig b/src/tty/tty.zig index 8f07d7fc..69934dd3 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -1163,7 +1163,9 @@ const Shell = struct { ) catch return; const tz_cells = tracy.zone(@src(), "surface->vaxis"); const win = vx.window(); - const trailed = s.trail.apply(s.frame.allocator(), surface, s.core, vx.caps.rgb or colortermTruecolor()) catch surface; + const truecolor = vx.caps.rgb or colortermTruecolor(); + const shadowed = chipShadows(s.frame.allocator(), surface, s.core, truecolor) catch surface; + const trailed = s.trail.apply(s.frame.allocator(), shadowed, s.core, truecolor) catch shadowed; paintCells(win, trailed.cells, trailed.cols, trailed.rows); tz_cells.end(); for (surface.images[0..surface.nimages]) |maybe| { @@ -1807,6 +1809,70 @@ fn paintCells(win: vaxis.Window, cells: []const pardes.Cell, cols: u16, rows: u1 } } +/// T1 (§9.2): each notice chip casts a shadow one cell right and one down, +/// inside its own pane's body: its ground 35% toward black in OKLab on a +/// cell with text; on a blank one a half block (▌ on the right, ▀ below, +/// ▘ at the corner) in the darker colour, so the shadow is half a cell +/// thick and reads as one. Never the cursor's cell, a selection, a tag or +/// another chip. Truecolor terminals only. +fn chipShadows(arena: std.mem.Allocator, surface: *pardes.Surface, core: *pardes.Pardes, truecolor: bool) !*pardes.Surface { + if (!core.settings.chip_shadow or !truecolor) return surface; + const regions = surface.regionList(); + const any = for (regions) |region| { + if (region.kind == .notice) break true; + } else false; + if (!any) return surface; + const out = try arena.create(pardes.Surface); + out.* = surface.*; + out.cells = try arena.dupe(pardes.Cell, surface.cells); + const theme = core.theme(); + const page = theme.bg orelse pardes.colors.null_page; + for (regions) |chip| { + if (chip.kind != .notice or chip.rect.w == 0) continue; + const body = for (regions) |region| { + if (region.kind == .body and region.owner == chip.owner) break region.rect; + } else continue; + const right = chip.rect.x + chip.rect.w; + const below = chip.rect.y + chip.rect.h; + // The column right of it (from its second row), the row below (from + // its second column), and the corner. + var y = chip.rect.y; + while (y <= below) : (y += 1) { + var x = chip.rect.x; + while (x <= right) : (x += 1) { + const side = x == right and y > chip.rect.y and y < below; + const foot = y == below and x > chip.rect.x and x < right; + const corner = x == right and y == below; + if (!side and !foot and !corner) continue; + if (x < body.x or y < body.y or x >= body.x + body.w or y >= body.y + body.h or x >= out.cols or y >= out.rows) continue; + if (surface.cursor) |cu| if (cu.x == x and cu.y == y) continue; + const covered = for (regions) |region| { + if ((region.kind == .notice or region.kind == .tag or region.kind == .grip) and x >= region.rect.x and x < region.rect.x + region.rect.w and y >= region.rect.y and y < region.rect.y + region.rect.h) break true; + } else false; + if (covered) continue; + const cell = &out.cells[@as(usize, y) * out.cols + x]; + const ground: [3]u8 = if (cell.default) page else switch (cell.style.bg) { + .rgb => |rgb| rgb, + else => page, + }; + if (std.mem.eql(u8, &ground, &theme.sel_bg)) continue; + const dark = pardes.colors.mixOklab(ground, .{ 0, 0, 0 }, 0.35); + const blank = cell.default or cell.len == 0 or (cell.len == 1 and cell.text[0] == ' '); + if (blank) { + const glyph: []const u8 = if (corner) "▘" else if (side) "▌" else "▀"; + cell.* = .{ .default = false, .style = .{ .fg = .{ .rgb = dark }, .bg = .{ .rgb = ground } } }; + @memcpy(cell.text[0..glyph.len], glyph); + cell.len = @intCast(glyph.len); + } else { + cell.default = false; + cell.style.bg = .{ .rgb = dark }; + } + } + } + } + return out; +} + /// Truecolor by COLORTERM (truecolor or 24bit), for a terminal that does /// not answer vaxis's query (§9.2: vaxis caps or COLORTERM). fn colortermTruecolor() bool { @@ -2200,3 +2266,39 @@ test "a jump leaves a trail of a few cells behind the cursor that fades in 120 m s.cursor = .{ .x = body.x + 2, .y = body.y + 1 }; try std.testing.expect(try trail.apply(arena.allocator(), s, core, false) == s); } + +test "a notice chip casts a cell's shadow right and down, inside its body, off the cursor" { + const gpa = std.testing.allocator; + const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer core.deinit(); + _ = try core.setTestFile("some text on a line\n" ** 20); + try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); + core.settings.chip_shadow = true; + try std.testing.expect(core.executeBuiltinLine(0, "Msg a notice")); + for (0..60) |_| core.update(.tick); + core.sync(); + var arena: std.heap.ArenaAllocator = .init(gpa); + defer arena.deinit(); + const s = try core.render(arena.allocator()); + const chip = for (s.regionList()) |region| { + if (region.kind == .notice) break region.rect; + } else return error.NoNotice; + s.cursor = null; + const out = try chipShadows(arena.allocator(), s, core, true); + try std.testing.expect(out != s); + var changed: usize = 0; + for (out.cells, s.cells, 0..) |a, b, i| { + if (std.meta.eql(a, b)) continue; + changed += 1; + const x = i % s.cols; + const y = i / s.cols; + // Right of the chip or below it, never inside it. + try std.testing.expect(x == chip.x + chip.w or y == chip.y + chip.h); + try std.testing.expect(!(x >= chip.x and x < chip.x + chip.w and y >= chip.y and y < chip.y + chip.h)); + } + try std.testing.expect(changed >= chip.w - 1); + // Off, or without truecolor: the frame as it was. + try std.testing.expect(try chipShadows(arena.allocator(), s, core, false) == s); + core.settings.chip_shadow = false; + try std.testing.expect(try chipShadows(arena.allocator(), s, core, true) == s); +} -- cgit v1.3 From 99149638c2b89fd134131d081bfd5fc8f967c53e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 09:04:44 -0300 Subject: T7: the scroll thumb flashes as a terminal pane scrolls ThumbFlash (off by default) brightens a body's scroll thumb toward the ink when its view moves and fades it back over 250 ms, truecolor only. The tty present path now clears shell_continuous once before its effects and each effect only raises it, so the trail and the flash no longer mask each other. --- docs/config.md | 2 ++ docs/effects.md | 1 + src/config.zig | 8 ++++- src/tty/tty.zig | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 104 insertions(+), 3 deletions(-) (limited to 'docs/effects.md') diff --git a/docs/config.md b/docs/config.md index 45677170..8b995e8a 100644 --- a/docs/config.md +++ b/docs/config.md @@ -587,6 +587,8 @@ JumpTrail on in a terminal, a jump of the cursor of three cells or more (truecolor terminals; a pixel shell glides instead) ChipShadow on in a terminal, a notice chip casts a shadow a cell right and down: half blocks on blank cells, a darker ground on text +ThumbFlash on in a terminal, a pane's scroll thumb brightens as it scrolls + and fades back over 250 ms CursorBlink on the cursor blinks, solid while typing and half a second after, eased at each edge, solid after 10 idle seconds GripWidth 150 the grip's button and the scrollbar under it, percent of the diff --git a/docs/effects.md b/docs/effects.md index c447b344..f5588e93 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -266,6 +266,7 @@ it does in a pixel shell. | T2 | cursor jump trail | `JumpTrail on\|off` (off) | a jump of three cells or more leaves 3 to 5 cells of trail behind the cursor, their ground drawn toward the text's colour in OKLab, most beside it, fading in 120 ms; truecolor terminals (vaxis's answer or COLORTERM); never the cursor's cell, a selection or outside the focused body; off under Motion off; a few cells a frame | .scratch/render/tty/trail/ (pyte replay of a real tty session at 60 fps: trail-forge.mp4, zooms) | pending | | T1 chip shadow | `ChipShadow on\|off` (off) | a notice chip casts a shadow a cell right and down in its body: half blocks (▌ ▀ ▘) in a darker ground on blank cells, the ground 35% darker (OKLab) under text; never the cursor, a selection, a tag or another chip; truecolor only | .scratch/render/tty/shadow/ (forge, acme; zooms) | pending | | T4 ordered swap | `PanelDissolve` (off) | the terminal's dissolve swaps each changed cell once at its place in a 4x4 Bayer matrix (shifted per pane), an even patterned screen instead of noise; hit-testing follows the same order | .scratch/render/tty/dissolve/ (ordered-swap-sim: the matrix applied to two real frames; see note) | pending | +| T7 thumb flash | `ThumbFlash on\|off` (off) | a pane whose view moves has its scroll thumb drawn toward the text's colour, 60% at once and back over 250 ms (quadratic); the thumb only, never a focus indicator; truecolor only; a few cells a frame while it fades | .scratch/render/tty/thumb-flash.mp4, thumb-flash-strip.png (pyte replay, forge) | pending | Note on T4's material: a pane opening in a tty session recorded through pyte did not animate (PanelSlide did not either there), so the review diff --git a/src/config.zig b/src/config.zig index 316ed3a0..1b432415 100644 --- a/src/config.zig +++ b/src/config.zig @@ -129,6 +129,7 @@ pub const leader_path = paths: { if (builtins.capabilities.lift) table.set(.Afterglow, null); table.set(.JumpTrail, null); table.set(.ChipShadow, null); + table.set(.ThumbFlash, null); if (builtins.capabilities.lift) table.set(.Lift, null); table.set(.Motion, null); table.set(.InactiveDim, null); @@ -694,6 +695,9 @@ pub const Runtime = struct { /// T1: in a terminal, a notice chip casts a cell's shadow right and /// down (truecolor terminals). chip_shadow: bool = false, + /// T7: in a terminal, a pane's scroll thumb brightens as it scrolls and + /// fades back (truecolor terminals). + thumb_flash: bool = false, /// How long a message stays after the key or click that dismisses it. message_linger_ms: u16 = 800, /// How long its fall into the row takes, easing out (§8.1: arriving, @@ -917,7 +921,7 @@ pub const Runtime = struct { /// The message timings a setting word sets, each in milliseconds. pub const MessageTime = enum { linger, fall, dissolve }; - pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax, afterglow, jump_trail, chip_shadow }; + pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax, afterglow, jump_trail, chip_shadow, thumb_flash }; /// A bundled post pass, a Shadertoy file in shaders/post/: the CRT, and /// G4's bloom, vignette and grain (docs/effects.md). pub const Scene = enum { crt, bloom, vignette, grain }; @@ -983,6 +987,7 @@ pub const Runtime = struct { .{ .word = "Afterglow", .action = .{ .toggle = .afterglow }, .availability = .lift, .doc = "Text that changes glows for a moment and fades, on or off." }, .{ .word = "JumpTrail", .action = .{ .toggle = .jump_trail }, .doc = "In a terminal, a jump of the cursor leaves a short trail that fades, on or off." }, .{ .word = "ChipShadow", .action = .{ .toggle = .chip_shadow }, .doc = "In a terminal, a notice chip casts a cell's shadow right and down, on or off." }, + .{ .word = "ThumbFlash", .action = .{ .toggle = .thumb_flash }, .doc = "In a terminal, a pane's scroll thumb brightens as it scrolls and fades back, on or off." }, .{ .word = "Lift", .action = .lift, .availability = .lift, .doc = "How the focused pane stands off the page: off, shadow, rim or auto." }, .{ .word = "Motion", .action = .motion, .doc = "How animations move: off, crisp, smooth, bouncy or playful." }, .{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." }, @@ -1723,6 +1728,7 @@ pub const Runtime = struct { .afterglow => "Afterglow on\n", .jump_trail => "JumpTrail on\n", .chip_shadow => "ChipShadow on\n", + .thumb_flash => "ThumbFlash on\n", }, .shell => "Shell requested (new panes) fish\n", .tagline_size => "TaglineSize 73\n", diff --git a/src/tty/tty.zig b/src/tty/tty.zig index 69934dd3..c4096faf 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -916,6 +916,8 @@ const Shell = struct { tracks: []const pardes.animation.Track = &.{}, /// T2: the cursor's jump trail (JumpTrail). trail: JumpTrail = .{}, + /// T7: when each pane's view last moved (ThumbFlash). + flash: ThumbFlash = .{}, /// PARDES_TEST_CLOCK's virtual time (host_io.testClock), and where the /// running-out wait moves it: the core's next wake. test_clock: ?u64 = null, @@ -1164,8 +1166,11 @@ const Shell = struct { const tz_cells = tracy.zone(@src(), "surface->vaxis"); const win = vx.window(); const truecolor = vx.caps.rgb or colortermTruecolor(); + // Each of the shell's own motions below asks for frames while it runs. + s.core.shell_continuous = false; const shadowed = chipShadows(s.frame.allocator(), surface, s.core, truecolor) catch surface; - const trailed = s.trail.apply(s.frame.allocator(), shadowed, s.core, truecolor) catch shadowed; + const flashed = s.flash.apply(s.frame.allocator(), shadowed, s.core, truecolor) catch shadowed; + const trailed = s.trail.apply(s.frame.allocator(), flashed, s.core, truecolor) catch flashed; paintCells(win, trailed.cells, trailed.cols, trailed.rows); tz_cells.end(); for (surface.images[0..surface.nimages]) |maybe| { @@ -1873,6 +1878,60 @@ fn chipShadows(arena: std.mem.Allocator, surface: *pardes.Surface, core: *pardes return out; } +/// T7 (§9.2): a pane whose view moved (Region.line) has its scroll thumb +/// brighten, drawn most of the way to the text's colour, and fade back +/// over 250 ms with an ease-out: where you are in the file, as you move. +/// The rail is chrome, not a focus indicator. Truecolor terminals only. +const ThumbFlash = struct { + lines: [pardes.MAX_PANES]i32 = @splat(std.math.minInt(i32)), + since: [pardes.MAX_PANES]u64 = @splat(0), + + const life_ns: u64 = 250 * std.time.ns_per_ms; + + fn apply(flash: *ThumbFlash, arena: std.mem.Allocator, surface: *pardes.Surface, core: *pardes.Pardes, truecolor: bool) !*pardes.Surface { + const on = core.settings.thumb_flash and truecolor and core.settings.motion != .off; + var out: ?*pardes.Surface = null; + const theme = core.theme(); + const ink = theme.fg orelse .{ 0xcc, 0xcc, 0xcc }; + for (surface.regionList()) |body| { + if (body.kind != .body or body.owner >= flash.lines.len) continue; + const id = body.owner; + if (flash.lines[id] != std.math.minInt(i32) and flash.lines[id] != body.line) flash.since[id] = core.now_ns; + flash.lines[id] = body.line; + const age = core.now_ns -| flash.since[id]; + if (!on or flash.since[id] == 0 or age >= life_ns) continue; + const rail = for (surface.regionList()) |region| { + if (region.kind == .rail and region.owner == id) break region; + } else continue; + if (rail.thumb_h == 0) continue; + const t = @as(f32, @floatFromInt(age)) / @as(f32, @floatFromInt(life_ns)); + const strength = 0.6 * (1 - t) * (1 - t); + if (out == null) { + const copy = try arena.create(pardes.Surface); + copy.* = surface.*; + copy.cells = try arena.dupe(pardes.Cell, surface.cells); + out = copy; + } + const o = out.?; + var y = rail.rect.y + rail.thumb_y; + while (y < rail.rect.y + rail.thumb_y + rail.thumb_h and y < o.rows) : (y += 1) { + var x = rail.rect.x; + while (x < rail.rect.x + rail.rect.w and x < o.cols) : (x += 1) { + const cell = &o.cells[@as(usize, y) * o.cols + x]; + const ground: [3]u8 = switch (cell.style.bg) { + .rgb => |rgb| rgb, + else => continue, + }; + if (!std.mem.eql(u8, &ground, &core.chromeTheme().scroll_thumb)) continue; + cell.style.bg = .{ .rgb = pardes.colors.mixOklab(ground, ink, strength) }; + } + } + core.shell_continuous = true; + } + return out orelse surface; + } +}; + /// Truecolor by COLORTERM (truecolor or 24bit), for a terminal that does /// not answer vaxis's query (§9.2: vaxis caps or COLORTERM). fn colortermTruecolor() bool { @@ -1896,7 +1955,7 @@ const JumpTrail = struct { const life_ns: u64 = 120 * std.time.ns_per_ms; fn apply(trail: *JumpTrail, arena: std.mem.Allocator, surface: *pardes.Surface, core: *pardes.Pardes, truecolor: bool) !*pardes.Surface { - defer core.shell_continuous = trail.active; + defer core.shell_continuous = trail.active or core.shell_continuous; const on = core.settings.jump_trail and truecolor and core.settings.motion != .off; const cursor = surface.cursor orelse { trail.active = false; @@ -2259,6 +2318,7 @@ test "a jump leaves a trail of a few cells behind the cursor that fades in 120 m // Gone by 120 ms; a step of a cell leaves none; nor a terminal without // truecolor. core.now_ns += 130 * std.time.ns_per_ms; + core.shell_continuous = false; const faded = try trail.apply(arena.allocator(), s, core, true); try std.testing.expect(faded == s and !trail.active and !core.shell_continuous); s.cursor = .{ .x = body.x + 13, .y = body.y + 1 }; @@ -2302,3 +2362,35 @@ test "a notice chip casts a cell's shadow right and down, inside its body, off t core.settings.chip_shadow = false; try std.testing.expect(try chipShadows(arena.allocator(), s, core, true) == s); } + +test "a scrolled pane's thumb brightens and fades back in 250 ms" { + const gpa = std.testing.allocator; + const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer core.deinit(); + const pane = try core.setTestFile("some text on a line\n" ** 200); + try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); + core.settings.thumb_flash = true; + for (0..40) |_| core.update(.tick); + core.sync(); + var arena: std.heap.ArenaAllocator = .init(gpa); + defer arena.deinit(); + var flash: ThumbFlash = .{}; + core.now_ns = std.time.ns_per_s; + const first = try core.render(arena.allocator()); + try std.testing.expect(try flash.apply(arena.allocator(), first, core, true) == first); + pane.scrollBy(20); + core.now_ns += 16 * std.time.ns_per_ms; + const moved = try core.render(arena.allocator()); + const lit = try flash.apply(arena.allocator(), moved, core, true); + try std.testing.expect(lit != moved and core.shell_continuous); + var brighter: usize = 0; + for (lit.cells, moved.cells) |a, b| { + if (!std.meta.eql(a.style.bg, b.style.bg)) brighter += 1; + } + try std.testing.expect(brighter >= 1); + core.now_ns += 300 * std.time.ns_per_ms; + core.shell_continuous = false; + const later = try core.render(arena.allocator()); + try std.testing.expect(try flash.apply(arena.allocator(), later, core, true) == later); + try std.testing.expect(!core.shell_continuous); +} -- cgit v1.3 From ab31baff1fbfd38180be8eed921b97082184f185 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 09:17:19 -0300 Subject: T3: PanelCurtain wipes behind a soft edge two cells wide The curtain's glyph slide becomes a wipe: the new grid behind a head that crosses the pane, the old ahead, and between them two columns whose colours step from the old ground to the new in OKLab (CharSource.edge). Only the head's columns change from frame to frame. --- docs/config.md | 2 +- docs/effects.md | 1 + src/animation.zig | 41 ++++++++++++++++++++++++++--------------- src/draw.zig | 20 ++++++++++++++++++++ 4 files changed, 48 insertions(+), 16 deletions(-) (limited to 'docs/effects.md') diff --git a/docs/config.md b/docs/config.md index 8b995e8a..189c5382 100644 --- a/docs/config.md +++ b/docs/config.md @@ -513,7 +513,7 @@ pair, and are composed in the core the same way: - `PanelEdges` — whole rows slide in from alternating screen edges. - `PanelFall` — columns rain down into place, each with its own head start. - `PanelWave` — a vertical ripple travels across the pane and decays. -- `PanelCurtain` — a curtain of glyphs marches column by column, left to right. +- `PanelCurtain` — a wipe, left to right, behind a soft edge two cells wide. - `PanelScramble` — every cell churns through printable ASCII and locks onto its final glyph at its own stable noise threshold. - `PanelType` — reading-order reveal with a caret sitting on the write head. diff --git a/docs/effects.md b/docs/effects.md index f5588e93..6685b577 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -267,6 +267,7 @@ it does in a pixel shell. | T1 chip shadow | `ChipShadow on\|off` (off) | a notice chip casts a shadow a cell right and down in its body: half blocks (▌ ▀ ▘) in a darker ground on blank cells, the ground 35% darker (OKLab) under text; never the cursor, a selection, a tag or another chip; truecolor only | .scratch/render/tty/shadow/ (forge, acme; zooms) | pending | | T4 ordered swap | `PanelDissolve` (off) | the terminal's dissolve swaps each changed cell once at its place in a 4x4 Bayer matrix (shifted per pane), an even patterned screen instead of noise; hit-testing follows the same order | .scratch/render/tty/dissolve/ (ordered-swap-sim: the matrix applied to two real frames; see note) | pending | | T7 thumb flash | `ThumbFlash on\|off` (off) | a pane whose view moves has its scroll thumb drawn toward the text's colour, 60% at once and back over 250 ms (quadratic); the thumb only, never a focus indicator; truecolor only; a few cells a frame while it fades | .scratch/render/tty/thumb-flash.mp4, thumb-flash-strip.png (pyte replay, forge) | pending | +| T3 wipe | `PanelCurtain` (off) | the curtain becomes a wipe, left to right: new grid behind the head, old ahead, and a soft edge of two columns whose ink and ground sit 2/3 and 1/3 of the way to the old ground (OKLab; a palette colour steps at the half); only the head's columns change a frame; the head's cells are not hit-testable until settled | .scratch/render/tty/wipe/ (curtain-gui.mp4, curtain-edge-zoom.png) | pending | Note on T4's material: a pane opening in a tty session recorded through pyte did not animate (PanelSlide did not either there), so the review diff --git a/src/animation.zig b/src/animation.zig index b682c770..840412f3 100644 --- a/src/animation.zig +++ b/src/animation.zig @@ -359,6 +359,9 @@ pub const CharSource = union(enum) { /// that cell holds — a caret marching over empty space is still a caret. byte: u8, churn: u8, + /// The destination cell with its colours still this far (0..1) toward + /// the frozen old cell's ground: a soft edge between the two grids. + edge: f32, pub const Offset = struct { cols: i32 = 0, rows: i32 = 0 }; @@ -390,12 +393,16 @@ pub fn charSource(track: Track, col: u16, row: u16, area: CellArea) CharSource { .wave => .{ .at = .{ .rows = cellsOf(remaining * @min(4.0, h) * @sin(c * 0.55 - t * 9.0)), } }, - // A curtain of glyphs marches in from the right, column by column, left - // to right; each column still has a short slide of its own. + // A wipe, left to right: the new grid behind the head, the old one + // ahead of it, and between them a soft edge two cells wide whose + // colours step from the old ground to the new. Only the head's + // columns change from one frame to the next. .curtain => blk: { - const lead = t * (w + 1.0) - c; + const lead = t * (w + 2.0) - c; if (lead <= 0.0) break :blk .old; - break :blk .{ .at = .{ .cols = -cellsOf(@max(0.0, 3.0 - lead)) } }; + if (lead <= 1.0) break :blk .{ .edge = 2.0 / 3.0 }; + if (lead <= 2.0) break :blk .{ .edge = 1.0 / 3.0 }; + break :blk .settled; }, // Every cell churns through printable ASCII and locks onto its final // glyph at its own stable threshold: the pane resolves out of noise. @@ -524,7 +531,7 @@ test "each character effect moves glyphs along its own axis" { var col: u16 = 0; while (col < area.cols) : (col += 1) switch (charSource(fall, col, 0, area)) { .old => {}, - .byte, .churn => return error.FallShouldNotChurn, + .byte, .churn, .edge => return error.FallShouldNotChurn, .at => |offset| { try std.testing.expectEqual(@as(i32, 0), offset.cols); try std.testing.expect(offset.rows >= 0); @@ -546,20 +553,24 @@ test "each character effect moves glyphs along its own axis" { } try std.testing.expect(above and below); - // The curtain has a head: columns behind it hold the old grid, columns the - // head has passed are settled, and the head itself is still sliding. + // The curtain wipes: columns ahead of its head hold the old grid, + // columns it has passed are settled, and between them a soft edge of + // exactly two columns steps from the old ground to the new. const curtain: Track = .{ .effect = .curtain, .frame = 5, .to = box }; try std.testing.expectEqual(CharSource.settled, charSource(curtain, 0, 0, area)); try std.testing.expectEqual(CharSource{ .old = {} }, charSource(curtain, 29, 0, area)); - var sliding = false; + var wiped: [2]f32 = undefined; + var at_edge: usize = 0; col = 0; while (col < area.cols) : (col += 1) switch (charSource(curtain, col, 0, area)) { - .at => |offset| if (offset.cols < 0) { - sliding = true; + .edge => |weight| { + wiped[at_edge] = weight; + at_edge += 1; }, - .old, .byte, .churn => {}, + .old, .at, .byte, .churn => {}, }; - try std.testing.expect(sliding); + try std.testing.expectEqual(@as(usize, 2), at_edge); + try std.testing.expect(wiped[0] < wiped[1]); var scramble: Track = .{ .effect = .scramble, .frame = 3, .to = box }; var churning: usize = 0; @@ -573,12 +584,12 @@ test "each character effect moves glyphs along its own axis" { scramble.frame = 4; switch (charSource(scramble, col, 0, area)) { .churn => |next| changed = changed or next != byte, - .old, .at, .byte => {}, + .old, .at, .byte, .edge => {}, } scramble.frame = 3; }, .at => locked += 1, - .old, .byte => return error.ScrambleShouldNotFreeze, + .old, .byte, .edge => return error.ScrambleShouldNotFreeze, }; try std.testing.expect(churning > 0 and locked > 0 and changed); @@ -598,7 +609,7 @@ test "each character effect moves glyphs along its own axis" { try std.testing.expectEqual(@as(u8, '_'), byte); carets += 1; }, - .old, .at, .churn => {}, + .old, .at, .churn, .edge => {}, }; } try std.testing.expectEqual(@as(usize, 1), carets); diff --git a/src/draw.zig b/src/draw.zig index 93d5b2d9..b0b16e12 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -723,6 +723,7 @@ fn composedCell( return switch (animation.charSource(track, col - area.x0, row - area.y0, area)) { .old => canonical.previous_cells[index], .byte => |byte| withByte(canonical.cells[index], byte), + .edge => |weight| towardGround(canonical.cells[index], canonical.previous_cells[index].style.bg, weight), // Churn belongs on the glyph, not on the pane's empty space, and it // borrows whichever side of the diff actually has one. .churn => |byte| blk: { @@ -749,6 +750,25 @@ fn composedCell( }; } +/// A cell with its ink and ground drawn `weight` of the way toward another +/// ground, in OKLab. A palette or default colour cannot be mixed, so the +/// ground steps over at the halfway point instead. +fn towardGround(cell: Cell, ground: Color, weight: f32) Cell { + var out = cell; + const to = switch (ground) { + .rgb => |rgb| rgb, + .default, .index => return if (weight >= 0.5) blk: { + out.style.bg = ground; + break :blk out; + } else out, + }; + inline for (.{ &out.style.fg, &out.style.bg }) |color| switch (color.*) { + .rgb => |rgb| color.* = .{ .rgb = colors.mixOklab(rgb, to, weight) }, + .default, .index => {}, + }; + return out; +} + fn withByte(cell: Cell, byte: u8) Cell { var out = cell; out.text[0] = byte; -- cgit v1.3 From 7f8b9d2e8666c2e2104abcd462d79cf6f949c718 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 09:24:41 -0300 Subject: effects.md: the terminal track's T5 and T6, and the byte budget, not built --- docs/effects.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'docs/effects.md') diff --git a/docs/effects.md b/docs/effects.md index 6685b577..8564b756 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -273,3 +273,10 @@ Note on T4's material: a pane opening in a tty session recorded through pyte did not animate (PanelSlide did not either there), so the review material applies the same matrix to two real frames of that session; the unit test holds the order (a 4x4 block reveals exactly t x 16 cells). + +Not built: T5 (unfocused dim) is InactiveDim, which already works in a +grid. T6 (a truecolor ramp on the active tag band) would change the +focused tag's colour, a focus indicator no effect may alter, so it stays +out. The §9.2 byte budget (deferring a sample after an oversized frame, +DECRQM for sync 2026) is not built either: the terminal effects here change +a few cells a frame, and only PanelSlide rewrites a whole pane per sample. -- cgit v1.3 From 3d262763b304021720f1141ab33265759869d2fe Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 10:03:10 -0300 Subject: The focused cursor rides with a moving pane, and a focus change glides to the new one G3's springs now keep the cursor's place in its pane: a pane that moves in the layout carries them, and the quad is drawn through the pane's presented box (its transition track), so through a slide, zoom or drag the cursor rides with the text, and with no transition it lands with it. A focus change, to another pane or into a column's or the workspace's tag, glides from where the cursor was drawn to the new place instead of snapping, unclamped while it crosses. While panes move the cursor is drawn as the overlay quad instead of vanishing (golden 18-mid-transition re-recorded for that: the only change is the quad, gliding into the new column's tag). Lapis: a tag plaque starts flush against its grip's button, the scroll gap between them part of the plaque, so grip and plaque read as one piece, on pane and column rows alike; below the button's row the grip keeps its band. Themes without plaques are unchanged (their grip band and tag band are one colour, no sliver). --- docs/effects.md | 7 ++ src/animation.zig | 2 +- src/draw.zig | 231 ++++++++++++++++++++++++++++++++++++++++++++++----- src/gui/gui.zig | 54 ++++++++---- src/pardes.zig | 4 +- test/gui-goldens.txt | 2 +- 6 files changed, 258 insertions(+), 42 deletions(-) (limited to 'docs/effects.md') diff --git a/docs/effects.md b/docs/effects.md index 8564b756..a0edc2ab 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -96,6 +96,13 @@ Which principles each motion uses: the flavour's arc), anticipation (playful's wind-up). A step of a cell or less, or any move in insert mode, lands at once, so typing never trails; a scroll carries the cursor with the text. Only the focused cursor moves. + A pane that moves carries it too: the springs keep its place in the pane + and the quad is drawn through the pane's presented box, so through a + slide, a zoom or a drag it rides with the text, and a layout change with + no transition lands it with the text. A focus change (to another pane, or + into a column's or the workspace's tag) glides from where the cursor is + drawn to the new one, free of the old pane's edges while it crosses + (.scratch/render/cursor/move/: ride-*, cross-*). Notes on G1: the lift and the dim run on one focus spring per pane, at the diff --git a/src/animation.zig b/src/animation.zig index 840412f3..19f7ce0b 100644 --- a/src/animation.zig +++ b/src/animation.zig @@ -1002,7 +1002,7 @@ pub const CursorGlide = struct { } } - fn centreAt(glide: *const CursorGlide, now_ns: u64) [2]f32 { + pub fn centreAt(glide: *const CursorGlide, now_ns: u64) [2]f32 { var c: [2]f32 = .{ 0, 0 }; for (glide.corners) |corner| for (&c, corner) |*sum, axis| { sum.* += axis.value(now_ns) / 4; diff --git a/src/draw.zig b/src/draw.zig index b0b16e12..15411770 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -212,6 +212,14 @@ fn focusedCursorBox(p: *const Pardes, s: *const Surface) ?animation.Box { /// at the Motion flavour's pace, a jump gliding and a step or a keystroke in /// insert mode landing at once; blinking unless typing. A pixel shell's: a /// grid's cursor is the terminal's own. +/// +/// The springs hold the cursor where the pane's final layout puts it, and +/// the quad is drawn through the pane's frame (paneFrame): while the pane +/// slides, zooms or is dragged, the cursor rides with its text. A pane that +/// moved in the layout carries the springs with it (they keep their place +/// in the pane), so with no transition the cursor lands with the text. A +/// focus change glides from where the cursor is drawn to the new pane's +/// cursor, wherever that pane is drawn now. fn glideCursor(p: *Pardes, s: *Surface) void { s.chrome.cursor_glide = 0; s.chrome.cursor_alpha = 1; @@ -220,26 +228,59 @@ fn glideCursor(p: *Pardes, s: *Surface) void { const box = focusedCursorBox(p, s) orelse return; const motion = animation.Motion.of(p.settings.motion); var snap = if (s.cursor) |cursor| cursor.bar else false; + var frame: PaneFrame = .{}; + // In a column's or the workspace's tag the cursor is not the pane's, + // and does not move with it. + var inside = false; if (p.panes[p.active]) |pane| { - // A focus change lands at once: a glide between panes would be - // squashed against the new one's edge. - if (p.cursor_view.serial != pane.serial) snap = true; - // Typing never trails: insert mode lands every move. - if (pane.body.mode == .insert) snap = true; - // Scrolled (a file's view, a terminal's output): the quad moves with - // the text and lands, never gliding against text that jumped (every - // Enter at a prompt scrolls one and moves the other). + const rect = p.rects[p.active]; + const cx = box.x + box.w / 2; + const cy = box.y + box.h / 2; + inside = cx >= @as(f32, @floatFromInt(rect.x)) and cx <= @as(f32, @floatFromInt(rect.x + rect.w)) and + cy >= @as(f32, @floatFromInt(rect.y)) and cy <= @as(f32, @floatFromInt(rect.y + rect.h)); + if (inside) frame = paneFrame(s, pane.serial, rect); + const origin: [2]f32 = .{ @floatFromInt(rect.x), @floatFromInt(rect.y) }; + const view = p.cursor_view; const line: i64 = if (pane.file) |f| @intCast(f.scroll) else if (pane.isTerminal()) panes.Terminal.gridOffset(pane) else 0; - if (p.cursor_view.serial == pane.serial and line != p.cursor_view.line) { - p.cursor_glide.shift(0, @floatFromInt(p.cursor_view.line - line)); - snap = true; + if (view.serial == pane.serial and view.inside == inside) { + // The pane moved in the layout: the springs move with it (its + // own cursor's; one in a column's tag stays). + if (inside) p.cursor_glide.shift(origin[0] - view.origin[0], origin[1] - view.origin[1]); + // Typing never trails: insert mode lands every move. + if (pane.body.mode == .insert) snap = true; + // Scrolled (a file's view, a terminal's output): the quad moves + // with the text and lands, never gliding against text that + // jumped (every Enter at a prompt scrolls one and moves the + // other). + if (inside and line != view.line) { + p.cursor_glide.shift(0, @floatFromInt(view.line - line)); + snap = true; + } + } else if (view.serial != 0 and p.cursor_glide.placed) { + // Focus moved (to another pane, or between a pane and a + // column's or the workspace's tag): the glide starts where the + // cursor is drawn, in the old place's frame, and heads for the + // new cursor through the new one's. + const old: PaneFrame = if (!view.inside) .{} else for (p.panes, 0..) |slot, id| { + const other = slot orelse continue; + if (other.serial != view.serial) continue; + const r = p.rects[id]; + p.cursor_glide.shift(@as(f32, @floatFromInt(r.x)) - view.origin[0], @as(f32, @floatFromInt(r.y)) - view.origin[1]); + break paneFrame(s, view.serial, r); + } else .{}; + const at = p.cursor_glide.centreAt(p.now_ns); + const seen = frame.unplace(old.place(at)); + p.cursor_glide.shift(seen[0] - at[0], seen[1] - at[1]); + p.cursor_crossing = true; } - p.cursor_view = .{ .serial = pane.serial, .line = line }; + p.cursor_view = .{ .serial = pane.serial, .line = line, .origin = origin, .inside = inside }; } p.cursor_glide.aim(box, p.now_ns, motion, snap); _ = p.cursor_glide.step(p.now_ns); const moving = p.cursor_glide.moving(); - s.chrome.cursor_glide = 2 | @as(u8, @intFromBool(moving)); + if (!moving) p.cursor_crossing = false; + // Drawn as the quad while it glides and while its pane moves. + s.chrome.cursor_glide = 2 | @as(u8, @intFromBool(moving or frame.moving())); // The shell blinks it, from how long ago the last key or click was. if (p.settings.cursor_blink) s.chrome.cursor_idle_ms = @intCast(@min(std.math.maxInt(u32) - 1, (p.now_ns -| p.input_ns) / std.time.ns_per_ms)); @@ -249,13 +290,51 @@ fn glideCursor(p: *Pardes, s: *Surface) void { const see_through: f32 = if (motion.zeta < 1) 0.7 else 0.85; s.chrome.cursor_alpha = if (moving) see_through + (1 - see_through) * std.math.clamp(1 - remaining / 0.5, 0, 1) else 1; const quad = p.cursor_glide.sample(p.now_ns, motion); - // Never outside the focused pane, however far a flavour overshoots or - // a scroll carried it: it squashes against the pane's edges. - const r = p.rects[p.active]; - for (quad, 0..) |point, i| { - s.chrome.cursor_quad[i * 2] = std.math.clamp(point[0], @as(f32, @floatFromInt(r.x)), @as(f32, @floatFromInt(r.x + r.w))); - s.chrome.cursor_quad[i * 2 + 1] = std.math.clamp(point[1], @as(f32, @floatFromInt(r.y)), @as(f32, @floatFromInt(r.y + r.h))); + // Never outside the focused pane as drawn, however far a flavour + // overshoots or a scroll carried it: it squashes against the pane's + // edges. Crossing to another pane, it may pass over any of the grid. + const bounds: animation.Box = if (p.cursor_crossing or !inside) + .{ .w = @floatFromInt(s.cols), .h = @floatFromInt(s.rows) } + else + frame.at; + for (quad, 0..) |corner, i| { + const point = frame.place(corner); + s.chrome.cursor_quad[i * 2] = std.math.clamp(point[0], bounds.x, bounds.x + bounds.w); + s.chrome.cursor_quad[i * 2 + 1] = std.math.clamp(point[1], bounds.y, bounds.y + bounds.h); + } +} + +/// Where a pane is drawn against where the layout puts it: its transition +/// track's presented box against the track's target, or the layout's box +/// both ways when it is still. Maps grid points between the two. +const PaneFrame = struct { + to: animation.Box = .{ .w = 1, .h = 1 }, + at: animation.Box = .{ .w = 1, .h = 1 }, + + fn moving(f: PaneFrame) bool { + return !std.meta.eql(f.to, f.at); + } + + fn place(f: PaneFrame, point: [2]f32) [2]f32 { + return .{ f.at.x + (point[0] - f.to.x) * scale(f.at.w, f.to.w), f.at.y + (point[1] - f.to.y) * scale(f.at.h, f.to.h) }; + } + + fn unplace(f: PaneFrame, point: [2]f32) [2]f32 { + return .{ f.to.x + (point[0] - f.at.x) * scale(f.to.w, f.at.w), f.to.y + (point[1] - f.at.y) * scale(f.to.h, f.at.h) }; + } + + fn scale(num: f32, den: f32) f32 { + return if (den > 0.001) num / den else 1; + } +}; + +fn paneFrame(s: *const Surface, serial: u32, rect: Rect) PaneFrame { + const still = layout.panelBox(rect); + for (s.panelTracks()) |track| { + if (track.serial != serial or track.phase == .closing or !track.active()) continue; + return .{ .to = track.to, .at = track.visualBox() }; } + return .{ .to = still, .at = still }; } /// The Lift style as drawn: `auto` is a shadow on a light page, and on a @@ -667,8 +746,10 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { } } }; - glideCursor(p, s); + // After the tracks are submitted: the cursor is drawn through its + // pane's. try p.presentation.submit(p, s); + glideCursor(p, s); return composeAsciiTransitions(p, arena, s); } @@ -1706,11 +1787,13 @@ test "a dim leaves a pair already under 4.5 alone, and reads a theme's own sixte try std.testing.expect(reverse.bg.rgb[0] < 255); } -test "with no lift and no dim a focus switch asks for no frames" { +test "with no lift, no dim and no motion a focus switch asks for no frames" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer p.deinit(); _ = try p.setTestFile("text\n"); p.newScratchBelow(0); + // With motion the cursor glides to the other pane (glideCursor). + p.settings.motion = .off; var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); p.advance(std.time.ns_per_s); @@ -2059,3 +2142,109 @@ test "a body with context rows is painted once, and the grid's rows are what a p try std.testing.expect(layer.rows > body.rect.h); } } + +/// Two columns, the file in the left one and a shell in the right, the +/// right one focused with its cursor settled. +fn twoColumns(p: *Pardes, arena: *std.heap.ArenaAllocator) !void { + _ = try p.setTestFile("some text on a line\n" ** 6); + _ = try p.newShell(1, ""); + try std.testing.expect(layout.splitColumn(p, 0, 1, false)); + p.sync(); + p.advance(std.time.ns_per_s); + const boot = try p.render(arena.allocator()); + p.acknowledgePanelPresentation(boot.panelTracks()); + p.advance(2 * std.time.ns_per_s); + _ = arena.reset(.retain_capacity); + const settled = try p.render(arena.allocator()); + p.acknowledgePanelPresentation(settled.panelTracks()); + try std.testing.expect(!p.cursor_glide.moving()); +} + +test "while its pane slides the cursor rides with it, at the same cell of the pane every frame" { + if (!builtins.capabilities.lift) return error.SkipZigTest; + const p = try Pardes.init(std.testing.allocator, .{ .cols = 120, .rows = 20 }); + defer p.deinit(); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + p.settings.motion = .bouncy; + try twoColumns(p, &arena); + p.active = 1; + p.advance(3 * std.time.ns_per_s); + _ = arena.reset(.retain_capacity); + p.acknowledgePanelPresentation((try p.render(arena.allocator())).panelTracks()); + p.advance(4 * std.time.ns_per_s); + p.settings.panel_transition = .slide; + // The right column's pane moves right. + p.col_weight[0] = layout.column_weight_unit * 2; + p.col_weight[1] = layout.column_weight_unit; + p.sync(); + var now: u64 = 4 * std.time.ns_per_s; + var riding: usize = 0; + for (0..40) |_| { + now += 16 * std.time.ns_per_ms; + p.advance(now); + _ = arena.reset(.retain_capacity); + const s = try p.render(arena.allocator()); + p.acknowledgePanelPresentation(s.panelTracks()); + const frame = paneFrame(s, p.panes[1].?.serial, p.rects[1]); + const box = focusedCursorBox(p, s).?; + const want = frame.place(.{ box.x, box.y }); + try std.testing.expectApproxEqAbs(want[0], s.chrome.cursor_quad[0], 0.01); + try std.testing.expectApproxEqAbs(want[1], s.chrome.cursor_quad[1], 0.01); + if (frame.moving()) { + riding += 1; + // Drawn as the quad while the pane moves. + try std.testing.expect(s.chrome.cursor_glide & 1 != 0); + } + } + try std.testing.expect(riding >= 3); + + // With no transition, the cursor lands with the text at once. + p.settings.panel_transition = .off; + p.col_weight[0] = layout.column_weight_unit; + p.col_weight[1] = layout.column_weight_unit * 2; + p.sync(); + now += 16 * std.time.ns_per_ms; + p.advance(now); + _ = arena.reset(.retain_capacity); + const landed = try p.render(arena.allocator()); + const box = focusedCursorBox(p, landed).?; + try std.testing.expectApproxEqAbs(box.x, landed.chrome.cursor_quad[0], 0.01); + try std.testing.expect(!p.cursor_glide.moving()); +} + +test "focus moved to another column glides from where the cursor was drawn" { + if (!builtins.capabilities.lift) return error.SkipZigTest; + const p = try Pardes.init(std.testing.allocator, .{ .cols = 120, .rows = 20 }); + defer p.deinit(); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + p.settings.motion = .smooth; + try twoColumns(p, &arena); + p.active = 0; + p.advance(3 * std.time.ns_per_s); + _ = arena.reset(.retain_capacity); + const before = try p.render(arena.allocator()); + try std.testing.expect(!p.cursor_glide.moving()); + const was: [2]f32 = .{ before.chrome.cursor_quad[0], before.chrome.cursor_quad[1] }; + + p.active = 1; + _ = arena.reset(.retain_capacity); + const start = try p.render(arena.allocator()); + // It sets off from where it was drawn, in the left column... + try std.testing.expectApproxEqAbs(was[0], start.chrome.cursor_quad[0], 0.01); + try std.testing.expectApproxEqAbs(was[1], start.chrome.cursor_quad[1], 0.01); + try std.testing.expect(p.cursor_glide.moving() and start.chrome.cursor_glide & 1 != 0); + // ...crosses the grid, not squashed against the right one's edge... + p.advance(3 * std.time.ns_per_s + 40 * std.time.ns_per_ms); + _ = arena.reset(.retain_capacity); + const mid = try p.render(arena.allocator()); + try std.testing.expect(mid.chrome.cursor_quad[0] > was[0] and mid.chrome.cursor_quad[0] < @as(f32, @floatFromInt(p.rects[1].x)) + 1); + // ...and lands on the right one's cursor. + p.advance(5 * std.time.ns_per_s); + _ = arena.reset(.retain_capacity); + const landed = try p.render(arena.allocator()); + const box = focusedCursorBox(p, landed).?; + try std.testing.expectApproxEqAbs(box.x, landed.chrome.cursor_quad[0], 0.01); + try std.testing.expect(!p.cursor_glide.moving() and !p.cursor_crossing); +} diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 2d31416b..18a1c8cb 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -5882,9 +5882,10 @@ fn renderFrame( } } var groups = makeGroups(surface.panelTracks(), surface.hasPanelDiff()); - // Cursors stand still while panes move, as they always have; while the - // focused one glides or blinks, it is the overlay's quad instead. One - // or the other every frame (none only at a blink's off half). + // While panes move the cells' cursors are not drawn; the focused one is + // the overlay's quad, riding with its pane (draw.glideCursor), as it is + // while it glides or blinks. One or the other every frame (none only at + // a blink's off half). const blink_alpha: f32 = if (blinkNow(g, chrome)) |b| b.alpha else 1; const quad_mode = chrome.cursor_glide & 2 != 0 and (chrome.cursor_glide & 1 != 0 or blink_alpha < 1); g.cursor_quad_alpha = if (quad_mode) chrome.cursor_alpha * blink_alpha else 0; @@ -6706,9 +6707,12 @@ fn emitSurfaceCell( // this underlay at tagline height leaves page-colored gutters between // adjacent workspace, column and pane tags at TaglineSize < 100. emitInstance(g, instances, next.*, col, row, body_layout, win_w, win_h, track, .body, (&band_base)[0..1], 0, null, old_layer, false, page); - // Over a theme's plaque (not a grip's button) the underlay lets it - // show (tagPlaques). - if (cell_decor.nplaques != 0 and !here.grip and cell_decor.inPlaque((@as(f32, @floatFromInt(col)) + 0.5) * body_layout.w + body_layout.x_off, @as(f32, @floatFromInt(row)) * body_layout.h + body_layout.y_off + 0.5)) + // Over a theme's plaque the underlay lets it show (tagPlaques), + // in a grip's cell too where the plaque reaches into it past the + // button (which is drawn over the cells). + const cell_x = @as(f32, @floatFromInt(col)) * body_layout.w + body_layout.x_off; + const cell_y = @as(f32, @floatFromInt(row)) * body_layout.h + body_layout.y_off + 0.5; + if (cell_decor.nplaques != 0 and cell_decor.inPlaque(if (here.grip) cell_x + body_layout.w - 0.5 else cell_x + 0.5, cell_y)) instances[next.*].effect |= clear_bg_bit; next.* += 1; // Tag glyphs keep their font size inside a full physical-width grip. @@ -7145,10 +7149,13 @@ test "lapis plaques stay in their tag's band, clear of every grip; only the focu const band = plaqueBox(&g, &s.chrome, s.regionList(), region, layout, 1280, 768) orelse continue; if (r[0] >= band.band[0] - 0.01 and r[1] >= band.band[1] - band.border - 0.01 and r[2] <= band.band[2] + 0.01 and r[3] <= band.band[3] + 0.01) break region; } else return error.PlaqueOutsideItsBand; + // Clear of every grip's button: a plaque starts flush against it, + // in the gap between it and the text. for (s.regionList()) |grip| { if (grip.kind != .grip and grip.kind != .column_grip) continue; - const gx0 = @as(f32, @floatFromInt(grip.rect.x)) * 16; - const gx1 = @as(f32, @floatFromInt(grip.rect.x + grip.rect.w)) * 16; + const column = scrollColumn(&g, &s.chrome, grip.rect.x, layout); + const gx0 = column[0]; + const gx1 = column[1]; const gy0 = @as(f32, @floatFromInt(grip.rect.y)) * 32; const gy1 = @as(f32, @floatFromInt(grip.rect.y + grip.rect.h)) * 32; try std.testing.expect(r[2] <= gx0 + 0.01 or r[0] >= gx1 - 0.01 or r[3] <= gy0 + 0.01 or r[1] >= gy1 - 0.01); @@ -7173,6 +7180,11 @@ test "lapis plaques stay in their tag's band, clear of every grip; only the focu if (tag.kind != .tag or tag.rect.y != column.rect.y + column.rect.h or tag.rect.x + tag.rect.w != column.rect.x + column.rect.w) continue; const lower = plaqueBox(&g, &s.chrome, s.regionList(), tag, layout, 1280, 768).?; try std.testing.expectEqual(upper.box[0], lower.box[0]); + // Flush against the grips' buttons, which line up too. + const grip = for (s.regionList()) |part| { + if (part.kind == .grip and part.owner == tag.owner) break part; + } else unreachable; + try std.testing.expectEqual(scrollColumn(&g, &s.chrome, grip.rect.x, layout)[1], lower.box[0]); try std.testing.expectEqual(upper.box[2], lower.box[2]); try std.testing.expectEqual(upper.band[3], upper.box[3]); try std.testing.expectEqual(lower.band[1] - lower.border, lower.box[1]); @@ -9382,14 +9394,15 @@ fn plaqueBox(g: *const Gui, chrome: *const pardes.Chrome, regions: []const parde const pane = tag.kind == .tag; const first = tag.rect.y; const last = tag.rect.y + tag.rect.h - 1; - // From its start, right of its grip: the gap cell before its text is - // the plaque's margin, so its frame is never under the first letter. A - // column's text sits a cell further in than a pane's; its plaque starts - // where the pane's under it does, at its grip's end. - const start = if (tag.kind == .column_tag) for (regions) |grip| { - if (grip.kind == .column_grip and grip.owner == tag.owner) break grip.rect.x + grip.rect.w; - } else tag.rect.x else tag.rect.x; - const x0 = @as(f32, @floatFromInt(@min(start, tag.rect.x))) * layout.w; + // Flush against its grip's button, so the two read as one piece: the + // gap between button and text (the scroll gap) is the plaque's, and so + // is the cell before its text, so its frame is never under the first + // letter. A column's plaque starts where the pane's under it does. + const grip_kind: pardes.Region.Kind = if (tag.kind == .column_tag) .column_grip else .grip; + const x0 = for (regions) |grip| { + if (tag.kind != .workspace_tag and grip.kind == grip_kind and grip.owner == tag.owner) + break scrollColumn(g, chrome, grip.rect.x, layout)[1]; + } else @as(f32, @floatFromInt(tag.rect.x)) * layout.w; const x1_cells = @as(f32, @floatFromInt(tag.rect.x + tag.rect.w)) * layout.w; const window_edge = win_w - x1_cells < layout.w; const x1 = if (window_edge) @max(x1_cells, win_w) else x1_cells; @@ -9454,7 +9467,13 @@ fn gripDecor(g: *Gui, gpa: std.mem.Allocator, regions: []const pardes.Region, ce const left = @as(f32, @floatFromInt(grip.rect.x)) * layout.w; const right = @as(f32, @floatFromInt(grip.rect.x + grip.rect.w)) * layout.w; try addDecor(g, gpa, left, button[1], button[0], button[3], band, 1, track, win_w, win_h); - try addDecor(g, gpa, button[2], button[1], right, button[3], band, 1, track, win_w, win_h); + // Right of it, a theme's plaque starts flush against it (plaqueBox). + const plaqued = chrome.decor_box_border != null and !cell_decor.plaques_off; + if (!plaqued) try addDecor(g, gpa, button[2], button[1], right, button[3], band, 1, track, win_w, win_h); + // Its cells over the plaque's reach are let through (emitInstance): + // under the button's row, the band goes on as far as the plaque. + if (plaqued and grip.rect.h > 1) + try addDecor(g, gpa, left, button[3], button[2], @as(f32, @floatFromInt(grip.rect.y + grip.rect.h)) * layout.h, band, 1, track, win_w, win_h); if (grip.kind != .grip) continue; // acme's button ring, two pixels (ButtonBorder) inside the button: // the focused one's in its own fill. An unfocused dirty one keeps a @@ -10160,7 +10179,6 @@ fn buildOverlay( fn appendCursorGlide(g: *Gui, surface: *const pardes.Surface, builder: *OverlayBuilder) void { const chrome = &surface.chrome; if (g.cursor_quad_alpha <= 0.001) return; - if (surface.panelTracks().len != 0) return; const layout = fixedCellLayout(g); var px: [4][2]f32 = undefined; var centre: [2]f32 = .{ 0, 0 }; diff --git a/src/pardes.zig b/src/pardes.zig index d6385e6f..2ee4e4ce 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -4347,7 +4347,9 @@ pub const Pardes = struct { /// scroll, G6): the core then keeps the continuous path running, so the /// shell draws every loop and a virtual clock moves on, as for a lift. shell_continuous: bool = false, - cursor_view: struct { serial: u32 = 0, line: i64 = 0 } = .{}, + cursor_view: struct { serial: u32 = 0, line: i64 = 0, origin: [2]f32 = .{ 0, 0 }, inside: bool = true } = .{}, + /// The cursor glides from one pane to another: it may cross the grid. + cursor_crossing: bool = false, input_ns: u64 = 0, animate_theme_changes: bool = false, native_images: bool = false, diff --git a/test/gui-goldens.txt b/test/gui-goldens.txt index 01bdfc7c..473e50a7 100644 --- a/test/gui-goldens.txt +++ b/test/gui-goldens.txt @@ -14,4 +14,4 @@ 15-theme-acme-light ca5252f5117ac8d6c679cef917c9f316c9ca311fc7a8dcbac2796b4fc04d3b64 16-debug 591bb7c45b4b9c46cd2458330b4fa3962afc6dac827fa6f5e20e927a72c586e6 17-terminal 38299427891e31de0b5597159501c161474620eb26fd7708a6396f0fd685209e -18-mid-transition 80cf350f8736fa4b348225a3872572a799ce57c763939796b68e8c839418f8ee +18-mid-transition 5d3e37d874988b460297e18df9508a77b602d5f675e28983c2c793871d4301f6 -- cgit v1.3