From d1d5d3cfb18841604bba2057eeb3598f729b4475 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 02:56:53 -0300 Subject: client #1, the views indexed: a view's share of the session is Pardes.View (the ~42 fields views.fields named: size, cell metrics, columns, rects, focus, jumps, pointer, gestures, prefixes, frontend), one of Pardes.views[4] (null when closed), the live one views[live] through Pardes.view() (index field `view` renamed `live`); going into another view is the index plus the panes' shares, which stay swapped (park and unpark now move only Pane.pv); views.zig loses fields, Part over Pardes, Parked, kept, emptied and the session half of every copy, and a pane closing leaves every view's layout at once (views.gone, at the two places a slot is freed) instead of the serials each parked view kept; drawOne and within put the drawn view's own share back whole; the views are in the digest now (tape's per-field parts name views[k].field), so a fresh view's col_x/col_w default to zeros, not undefined; the dump keeps every open view in the core and the panes' shares of the others under `shares`; an image from before (live view as the core's own fields, the rest under `views`) loads them into views[] once; the ~2,400 references rewritten mechanically from the compiler's errors (p.active is p.view().active, `const v = p.view()` hoisted in 823 places), Kind.zig (4 lines) and addon_test.zig (3) among them, macos.zig by pattern (not compiled here); tape's watched host writes read the live view's frontend and active; perf.zig's accessor lines change its harness hash, the debug baselines re-keyed to it (their numbers the base's); no golden changes; gates: core-test 956/956 both, unit-test 1487/1488 tui and 1530/1531 gui, behaviour-test 248/248 both, pane-test 171/172, snap all 105 ok, process-test 0 of 37 failed tui, replicas ok Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Kind.zig | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/Kind.zig') diff --git a/src/Kind.zig b/src/Kind.zig index e5332831..241acf4b 100644 --- a/src/Kind.zig +++ b/src/Kind.zig @@ -366,7 +366,7 @@ pub fn paint(p: *const Pardes, slot: *Slot, id: usize, arena: std.mem.Allocator, const cells = arena.alloc(c.pa_cell, @as(usize, cols) * rows) catch return null; @memset(std.mem.sliceAsBytes(cells), 0); var out: c.pa_paint = std.mem.zeroInit(c.pa_paint, .{ .placements = &frame.buf, .cap = frame.buf.len }); - const px = if (comptime pardes.pdf_enabled) p.cell_pixels else struct { w: u16 = 8, h: u16 = 16 }{}; + const px = if (comptime pardes.pdf_enabled) p.view().cell_pixels else struct { w: u16 = 8, h: u16 = 16 }{}; const win = std.mem.zeroInit(c.pa_window, .{ .cells = cells.ptr, .stride = cols, .rows = rows, .cols = cols, .cell_w = px.w, .cell_h = px.h, .focused = @intFromBool(focusedAnywhere(p, id)) }); var cl: Call = .{ .p = null, .id = 0, .slot = slot, .quiet = true }; const prev = cl.begin("paint"); @@ -430,7 +430,7 @@ fn prefixOf(p: *const Pardes, slot: *const Slot, buf: *[400]u8) []const u8 { var w: std.Io.Writer = .fixed(buf); w.writeAll(if (own.len > 0) own else slot.nameOf()) catch {}; if (placed) w.print(" petscii:{s} palette:{t} ascii:{s}", .{ - if (slot.art.glyph or !p.frontend.native_images) "on" else "off", + if (slot.art.glyph or !p.view().frontend.native_images) "on" else "off", slot.art.palette, if (slot.art.ascii) "on" else "off", }) catch {}; @@ -524,8 +524,7 @@ pub fn step(p: *Pardes) void { /// Whether pane `id` has the keyboard in some view (its window focused). fn focusedAnywhere(p: *const Pardes, id: usize) bool { - if (p.active == id and p.window_focused) return true; - for (p.parked, 0..) |v, k| if (v) |pv| if (k != p.view and views.isOpen(p, @intCast(k)) and pv.view.active == id and pv.view.window_focused) return true; + for (&p.views) |*v| if (v.*) |*vw| if (vw.active == id and vw.window_focused) return true; return false; } -- cgit v1.3