summaryrefslogtreecommitdiff
path: root/src/macos.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 02:56:53 -0300
committerGabriel Schneider <[email protected]>2026-11-06 04:13:33 -0300
commitd1d5d3cfb18841604bba2057eeb3598f729b4475 (patch)
tree298c29ab8767852bf74eb86ad4d15acc4348f109 /src/macos.zig
parent33037ece5af9ae1c7048819bbbae3fc5e6fc4ade (diff)
downloadpardes-d1d5d3cfb18841604bba2057eeb3598f729b4475.tar.gz
pardes-d1d5d3cfb18841604bba2057eeb3598f729b4475.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/macos.zig')
-rw-r--r--src/macos.zig38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/macos.zig b/src/macos.zig
index a152edfc..3ba5f52a 100644
--- a/src/macos.zig
+++ b/src/macos.zig
@@ -356,11 +356,11 @@ test "mac worker setup failures finish matching LSP and pipe requests" {
};
defer st.config_arena.deinit();
defer st.inbox.close();
- core.lspRequest(core.active, .status, "");
+ core.lspRequest(core.view().active, .status, "");
const req: host_io.Lsp.Request = .{
.id = core.lsp_ask.wait.?.id,
.kind = .status,
- .pane = @intCast(core.active),
+ .pane = @intCast(core.view().active),
.offset = 0,
.arg = "",
};
@@ -530,7 +530,7 @@ fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void {
std.mem.eql(u8, std.mem.span(v), "1")
else
@import("pardes_config").workspace_tag;
- core.frontend.native_images = true;
+ core.view().frontend.native_images = true;
var prompt_rcs = host_io.Shell.prepare();
errdefer prompt_rcs.deinit();
@@ -1083,7 +1083,7 @@ fn drainInbox(st: *State) bool {
},
.lsp_status => |text| {
var mbuf: [256]u8 = undefined;
- st.core.setStatus(st.core.active, message.stamp(&mbuf, "lsp", text));
+ st.core.setStatus(st.core.view().active, message.stamp(&mbuf, "lsp", text));
},
.pipe => |value| {
st.core.update(.{ .pipe_resp = .{
@@ -1140,12 +1140,12 @@ fn restoreCore(st: *State) bool {
if (st.core.quit) return false;
const path = st.core.takeRestore() orelse return false;
const bytes = dump.restoreBytes(st.core, st.gpa, path) catch |err| {
- st.core.reportError(st.core.active, "Restore", err);
+ st.core.reportError(st.core.view().active, "Restore", err);
return false;
};
defer st.gpa.free(bytes);
const replacement = dump.restore(st.core, bytes, path) catch |err| {
- st.core.reportError(st.core.active, "Restore", err);
+ st.core.reportError(st.core.view().active, "Restore", err);
return false;
};
if (st.inbox.lsp_task) |*task| {
@@ -1438,7 +1438,7 @@ export fn pardes_mouse_pixel(button_arg: c_int, kind_arg: c_int, col: u16, row:
pardes.turn.wake();
defer pardes.turn.rest();
const st = &(state orelse return);
- const source = st.core.presentation.pointerFractional(st.core.screen_w, st.core.screen_h, x / @max(1, bw), y / @max(1, bh));
+ const source = st.core.presentation.pointerFractional(st.core.view().screen_w, st.core.view().screen_h, x / @max(1, bw), y / @max(1, bh));
var hit: ?pardes.Mouse.BodyHit = null;
for (&st.core.surface.body_layers) |*layer| {
const point = source orelse break;
@@ -1762,8 +1762,8 @@ fn collectImages(st: *State, surface: *const pardes.Surface) void {
for (placements) |place| {
if (place.raster.w == 0 or place.raster.h == 0) continue;
const dst = place.at orelse pardes.RectPx{
- .w = @as(u32, place.dst.w) * st.core.cell_pixels.w,
- .h = @as(u32, place.dst.h) * st.core.cell_pixels.h,
+ .w = @as(u32, place.dst.w) * st.core.view().cell_pixels.w,
+ .h = @as(u32, place.dst.h) * st.core.view().cell_pixels.h,
};
if (dst.w == 0 or dst.h == 0 or place.src.w == 0 or place.src.h == 0) continue;
var scroll: f64 = 0;
@@ -1984,7 +1984,7 @@ export fn pardes_row_metrics(body_w: u16, body_h: u16, tagline_w: u16, tagline_h
pardes.turn.wake();
defer pardes.turn.rest();
const st = &(state orelse return);
- st.core.update(.{ .resize = .{ .cols = st.core.screen_w, .rows = st.core.screen_h, .cell_pixels = st.core.cell_pixels, .row_metrics = .{ .body_w = @max(1, body_w), .body_h = @max(1, body_h), .tagline_w = @max(1, tagline_w), .tagline_h = @max(1, tagline_h) } } });
+ st.core.update(.{ .resize = .{ .cols = st.core.view().screen_w, .rows = st.core.view().screen_h, .cell_pixels = st.core.view().cell_pixels, .row_metrics = .{ .body_w = @max(1, body_w), .body_h = @max(1, body_h), .tagline_w = @max(1, tagline_w), .tagline_h = @max(1, tagline_h) } } });
}
export fn pardes_pointer_shape() u32 {
@@ -2085,14 +2085,14 @@ export fn pardes_active_dirty() bool {
pardes.turn.wake();
defer pardes.turn.rest();
const st = &(state orelse return false);
- const pane = st.core.panes[st.core.active] orelse return false;
+ const pane = st.core.panes[st.core.view().active] orelse return false;
const f = if (pane.file) |*x| x else return false;
if (f.output != null) return false;
return f.revision != f.saved_revision;
}
fn activeFilePath(st: *State) ?[]const u8 {
- const pane = st.core.panes[st.core.active] orelse return null;
+ const pane = st.core.panes[st.core.view().active] orelse return null;
if (pane.file) |*f| return if (f.output == null) f.path else null;
if (comptime pardes.pdf_enabled) if (pane.pdfPath()) |path| return path;
if (pane.addon) |k| return k.path;
@@ -2145,7 +2145,7 @@ fn spawnShell(ctx: ?*anyopaque, pane: u8, cwd: []const u8) void {
// The new shell starts before a running one goes: one that cannot
// start leaves the running one be (pty/ctl's exec).
const running = st.ptys[pane] != null;
- const child = host_io.forkShell(core, pane, &st.prompt_rcs, core.shellBin(), cwd, core.screen_h, core.screen_w) catch |err| {
+ const child = host_io.forkShell(core, pane, &st.prompt_rcs, core.shellBin(), cwd, core.view().screen_h, core.view().screen_w) catch |err| {
if (running) return core.restartFailed(pane, err);
return core.shellFailed(pane, err);
};
@@ -2815,14 +2815,14 @@ test "mac row metrics ABI preserves PDF cell dimensions and the unrendered grid"
state.?.config_arena.deinit();
state = null;
}
- if (comptime pardes.pdf_enabled) core.cell_pixels = .{ .w = 22, .h = 39 };
- const pixels = core.cell_pixels;
+ if (comptime pardes.pdf_enabled) core.view().cell_pixels = .{ .w = 22, .h = 39 };
+ const pixels = core.view().cell_pixels;
try std.testing.expectEqual(@as(u16, 0), core.surface.cols);
pardes_row_metrics(22, 39, 17, 30);
- try std.testing.expectEqualDeep(pixels, core.cell_pixels);
- try std.testing.expectEqual(@as(u16, 80), core.screen_w);
- try std.testing.expectEqual(@as(u16, 24), core.screen_h);
- try std.testing.expectEqualDeep(pardes.RowMetrics{ .body_w = 22, .body_h = 39, .tagline_w = 17, .tagline_h = 30 }, core.row_metrics);
+ try std.testing.expectEqualDeep(pixels, core.view().cell_pixels);
+ try std.testing.expectEqual(@as(u16, 80), core.view().screen_w);
+ try std.testing.expectEqual(@as(u16, 24), core.view().screen_h);
+ try std.testing.expectEqualDeep(pardes.RowMetrics{ .body_w = 22, .body_h = 39, .tagline_w = 17, .tagline_h = 30 }, core.view().row_metrics);
}
test "mac tag layer ABI preserves logical capacity and physical grip" {