a73x

c1e97b1e

scenario: polish — indent + RunContext geom comment

a73x   2026-04-19 14:08

Commit message
scenario: polish — indent + RunContext geom comment

Re-indents the scale_pending else-branch body one level
deeper to match Zig's if/else convention; purely cosmetic.

Documents RunContext's geometry snapshotting invariant so a
future contributor adding a live-geom-read path knows to
wire scale-change propagation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

src/main.zig
Old New
@@ -621,33 +621,33 @@ fn runTerminal(alloc: std.mem.Allocator, tick_ctx: ?*scenario_runtime.RunContext
621 last_scale = current_scale; 621 last_scale = current_scale;
622 scale_pending = false; 622 scale_pending = false;
623 } else { 623 } else {
624 vk_sync.waitIdleForShutdown(ctx.vkd, ctx.device); 624 vk_sync.waitIdleForShutdown(ctx.vkd, ctx.device);
625 625
626 geom = try rebuildFaceForScale( 626 geom = try rebuildFaceForScale(
627 &face, 627 &face,
628 &atlas, 628 &atlas,
629 font_lookup.path, 629 font_lookup.path,
630 font_lookup.index, 630 font_lookup.index,
631 font_size, 631 font_size,
632 current_scale, 632 current_scale,
633 ); 633 );
634 cell_w = geom.cell_w_px; 634 cell_w = geom.cell_w_px;
635 cell_h = geom.cell_h_px; 635 cell_h = geom.cell_h_px;
636 baseline = geom.baseline_px; 636 baseline = geom.baseline_px;
637 637
638 // Wipe all cached row instances + mark the terminal fully dirty so that 638 // Wipe all cached row instances + mark the terminal fully dirty so that
639 // every glyph gets re-inserted into the freshly reset atlas next frame. 639 // every glyph gets re-inserted into the freshly reset atlas next frame.
640 render_cache.invalidateAfterResize(); 640 render_cache.invalidateAfterResize();
641 term.render_state.dirty = .full; 641 term.render_state.dirty = .full;
642 642
643 window.surface.setBufferScale(geom.buffer_scale); 643 window.surface.setBufferScale(geom.buffer_scale);
644 644
645 const buf_w = window.width * @as(u32, @intCast(geom.buffer_scale)); 645 const buf_w = window.width * @as(u32, @intCast(geom.buffer_scale));
646 const buf_h = window.height * @as(u32, @intCast(geom.buffer_scale)); 646 const buf_h = window.height * @as(u32, @intCast(geom.buffer_scale));
647 try ctx.recreateSwapchain(buf_w, buf_h); 647 try ctx.recreateSwapchain(buf_w, buf_h);
648 648
649 last_scale = geom.buffer_scale; 649 last_scale = geom.buffer_scale;
650 scale_pending = false; 650 scale_pending = false;
651 } 651 }
652 } 652 }
653 653
src/scenario_runtime.zig
Old New
@@ -46,6 +46,11 @@ pub const RunContext = struct {
46 offscreen: ?*renderer.OffscreenTarget = null, 46 offscreen: ?*renderer.OffscreenTarget = null,
47 face: ?*font.Face = null, 47 face: ?*font.Face = null,
48 atlas: ?*font.Atlas = null, 48 atlas: ?*font.Atlas = null,
49 /// Snapshotted at scenario-start from runTerminal's live geometry.
50 /// Never updated even if the compositor changes scale mid-scenario —
51 /// captures use the fixed offscreen target, so stale on-screen geom
52 /// is inert. If you later add a path that re-reads live geom inside
53 /// a capture, you MUST wire scale-change propagation here too.
49 cell_w: u32 = 0, 54 cell_w: u32 = 0,
50 cell_h: u32 = 0, 55 cell_h: u32 = 0,
51 baseline: u32 = 0, 56 baseline: u32 = 0,