From d8e5fc18f5923c4213de1cb4105a677e725200af Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 21:02:51 -0300 Subject: fields #41, a view's frontend is one field: windowed, native_images and native_image_patches, the three fields Event.frontend carries, are the session's frontend, a Frontend, so update's frontend arm is p.frontend = f where it copied them one by one; native_image_patches, each process's own, is said so on Frontend (its replica .local), where the session's list said it, so the digest and a dump leave it out as before, and the tape watches frontend where it watched the three (a host's write of patches alone, which only drawing reads, is no longer a set of its own on the tape); the reads in 22 files say p.frontend.native_images (macos.zig's by text, built nowhere here; dump.zig, the persistence agent's, only where it names native_images); views.zig's per-view fields name frontend; a dump written before this change loads it as the default once: an Upgrade or Restore from it comes back as a terminal's view without native images until its frontend says otherwise (a window's says so at once), and the wire's semantics change; gates on tui: core-test 960/960, behaviour-test 238/238, pane-test 171/172 (1 skipped), snap all 108 scripts ok; gui unit-test 1518/1519 (1 skipped) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Core.zig | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'src/Core.zig') diff --git a/src/Core.zig b/src/Core.zig index c5665cb5..0efe447b 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -23,6 +23,7 @@ const Handover = pardes.Handover; const Host = pardes.Host; const ImagePlace = pardes.ImagePlace; const Jump = pardes.Jump; +const Frontend = @import("Event.zig").Frontend; const Ask = pardes.lsp.Ask; const Key = pardes.Key; const Loc = Jump.Loc; @@ -193,11 +194,10 @@ theme_file_pane: u8 = 0, chrome: colors.ChromeTheme = colors.initial_chrome, /// Every drawn frame's timings (FrameStats: the Debug box, PARDES_FRAMES). frames: FrameStats = .{}, -native_images: bool = false, -/// The shell can take a changed image a few rows at a time (a texture row -/// upload, a shared-memory hand-off), so a PDF selection is repainted as -/// it is dragged instead of once on release. -native_image_patches: bool = false, +/// The live view's frontend (Event.frontend): a window, what it draws and +/// the words it takes (builtins.zig `here`); it starts as +/// `Options.windowed` says. +frontend: Frontend = .{ .windowed = false }, quit: bool = false, /// A detached session with no frontend attached: nothing renders, so /// no input ever dismisses a message (Messages.expireUnattended). @@ -218,14 +218,10 @@ pointer_raw_row: u16 = 0, pointer_body_hit: ?Mouse.BodyHit = null, pointer_tag_hit: ?TagHit = null, raw_hover_intent: bool = false, -pointer_inside: bool = false, /// A pixel shell's window, which hears the pointer leave it: only then /// does /status say whether the pointer is over it (a terminal's mouse /// reports never say it left, so a tty would claim it for ever). -/// The live view's frontend is a window (Event.frontend): what it draws, -/// and the words it takes (builtins.zig `here`). It starts as -/// `Options.windowed` says. -windowed: bool = false, +pointer_inside: bool = false, /// The last plain B1 click, for acme's double-click (text.c:881, /// textselect: a second click at the same point within 500 ms). last_click: ?struct { id: usize, on_tag: bool, row: i32, col: i32, ms: i64 } = null, @@ -396,7 +392,7 @@ pub const replica = .{ // A frame, and the timings that make it. "surface", "frames", "chrome", "frame_arena", "scratch", - "needs_frame", "present_skipped", "native_image_patches", + "needs_frame", "present_skipped", "echo", // Drained by every pump before its digest; a replica's queues // are its own. @@ -471,7 +467,7 @@ pub fn create(gpa: std.mem.Allocator, opts: Options) !*Pardes { .pdf_gpa = opts.pdf_allocator orelse gpa, .tree_sitter_gpa = opts.tree_sitter_allocator orelse gpa, .opts = opts, - .windowed = opts.windowed, + .frontend = .{ .windowed = opts.windowed }, .tty_toggle = opts.tty_toggle, .col_tags = @splat(.{ .what = .column, .gpa = gpa }), .global_tag = .{ .what = .workspace, .gpa = gpa }, @@ -1614,7 +1610,7 @@ pub fn update(p: *Pardes, ev: Event) void { if (comptime pdf_enabled) { if (scroll.pane < MAX_PANES) { if (p.panes[scroll.pane]) |pane| { - if (pane.hasPdf() and p.native_images) + if (pane.hasPdf() and p.frontend.native_images) _ = pardes.panes.Pdf.scrollPane(p, pane, @floatCast(scroll.delta_pixels), scroll.glide); } } @@ -1631,9 +1627,7 @@ pub fn update(p: *Pardes, ev: Event) void { }, .handed => |h| p.handover.finish(p, h.seq, h.to, h.failure), .frontend => |f| { - p.windowed = f.windowed; - p.native_images = f.native_images; - p.native_image_patches = f.native_image_patches; + p.frontend = f; }, .pointer_leave => { p.pointer_inside = false; @@ -2126,7 +2120,7 @@ pub const Boot = enum { pub const Options = struct { tty_only: bool = false, - /// The first view's frontend is a window (`Pardes.windowed`), as a + /// The first view's frontend is a window (`Pardes.frontend`), as a /// window's build says: an option, taped with the rest, so that a /// window's build replaying a terminal's session starts as it did. windowed: bool = platform == .gui, -- cgit v1.3