From a3be36960661a9d4c857c9c38797cc7f0690a71a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 15:03:12 -0300 Subject: macos: the State field runtime is callbacks, as its type became macos.Callbacks (P37): runtime/macos.zig's field, pardes_init's and initCore's parameter, the store of it, its six readers (st.callbacks.set_clipboard, read_clipboard, wakeup and their userdata) and six test literals; abi/pardes.h's pardes_init prototype names its parameter callbacks (the typedef already did); the Swift locals that build the struct and hand it in, `var runtime` and `&runtime` -> `callbacks` at dev/macos/Sources/AppDelegate.swift:135 and :171 and test/macos_e2e.swift:171 and :203 (not built here: the Swift app needs macOS; by reading the name meets nothing in either scope); the prose "the runtime" (the host app, macos.zig:135, :264) stays; the ABI guard (unit-test -Dplatform=macos, "pardes.h matches the Zig boundary") 2/2 on Linux; gate on the stack through this change and the docking vocabulary (load 4-32): tui core-test 871/1028 (157 skipped), shell-test 1070/1073, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275 and --replay 275/275, consumer-test passes, addon-test 5/5, process-test 0 of 144 (tty boot: msg failed once at load 32 and passed alone), replicas --clients 5 and --bytes --clients 5: diverged 0, unequal 0, deltas wrong 0, quiet checks differed 0, unlisted stops 0, corpus 22 of 22, no leak; the semantics word a73794ff9e03f814 as on merge40; daemon.py --far, --games, --window-clients pass, plain fails 2 of 4 at "client C agrees with a shell's output" (a timeout), as merge40's build does 3 of 6; the macOS library (x86_64-linux, aarch64-macos, the ABI guard 2/2) and the FreeBSD cross-build build; frames 77/77, gui unit-test 1666/1670 (the perf check's BaselineHarnessMismatch), perfab corpus2x +0.054% (noise 0.054%), the 121 per-operation counts within 0.1% against tree2 (key-down on medium 10,039,720 and render on medium 11,454,636, merge40's gate 10,039,703 and 11,454,619) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- runtime/macos.zig | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'runtime/macos.zig') diff --git a/runtime/macos.zig b/runtime/macos.zig index 4f9a9c33..1954cfa5 100644 --- a/runtime/macos.zig +++ b/runtime/macos.zig @@ -250,7 +250,7 @@ const State = struct { io: std.Io, core: *pardes.Pardes, started: bool = false, - runtime: Callbacks, + callbacks: Callbacks, tag_cells: [pardes.MAX_TAG_LAYERS][]Cell = @splat(&.{}), layer_cells: [pardes.MAX_PANES][]Cell = @splat(&.{}), cells: []Cell = &.{}, @@ -290,9 +290,9 @@ const State = struct { var state: ?State = null; -export fn pardes_init(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16) c_int { +export fn pardes_init(callbacks: ?*const Callbacks, cols_arg: u16, rows_arg: u16) c_int { if (state != null) return 1; // already up; deinit first - initCore(runtime, cols_arg, rows_arg) catch |err| { + initCore(callbacks, cols_arg, rows_arg) catch |err| { log.err("init failed: {t}", .{err}); return 2; }; @@ -302,7 +302,7 @@ export fn pardes_init(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16) /// The shell's gpa in a Debug build, as std.start's is for the others. var debug_gpa: std.heap.DebugAllocator(.{}) = .init; -fn initCore(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16) !void { +fn initCore(callbacks: ?*const Callbacks, cols_arg: u16, rows_arg: u16) !void { // The allocator every other shell gets from std.start: a DebugAllocator // in Debug, libc's malloc otherwise. libc's measured at least as fast as // std.heap.smp_allocator everywhere and faster on MuPDF's page-sized @@ -373,7 +373,7 @@ fn initCore(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16) !void { .core = core, .config_arena = config_arena, .prompt_rcs = prompt_rcs, - .runtime = if (runtime) |r| r.* else .{}, + .callbacks = if (callbacks) |c| c.* else .{}, }; const st = &state.?; st.inbox = .{ .gpa = gpa, .lsp_allocator = gpa, .io = io, .wake_fn = wakeHost, .wake_ctx = st }; @@ -1758,14 +1758,14 @@ fn dumpThemes(ctx: ?*anyopaque, id: pardes.Pane.Id) void { fn setClipboard(ctx: ?*anyopaque, text: []const u8) void { const st = hostState(ctx); - const cb = st.runtime.set_clipboard orelse return; - cb(st.runtime.userdata, text.ptr, text.len); + const cb = st.callbacks.set_clipboard orelse return; + cb(st.callbacks.userdata, text.ptr, text.len); } fn readClipboard(ctx: ?*anyopaque) void { const st = hostState(ctx); - const cb = st.runtime.read_clipboard orelse return; - cb(st.runtime.userdata); + const cb = st.callbacks.read_clipboard orelse return; + cb(st.callbacks.userdata); } fn openLink(_: ?*anyopaque, url: []const u8) void { @@ -1803,9 +1803,9 @@ fn wakeHost(ctx: ?*anyopaque) void { } fn wake(st: *State) void { - const cb = st.runtime.wakeup orelse return; + const cb = st.callbacks.wakeup orelse return; if (st.wake_pending.swap(true, .acq_rel)) return; - cb(st.runtime.userdata); + cb(st.callbacks.userdata); } fn captureEnv(arena: std.mem.Allocator) ?std.process.Environ.Map { @@ -2058,7 +2058,7 @@ test "mac queued results never cancel a newer LSP request" { .threaded = undefined, .io = std.testing.io, .core = core, - .runtime = .{}, + .callbacks = .{}, .config_arena = .init(gpa), .prompt_rcs = .{}, .inbox = .{ .gpa = gpa, .lsp_allocator = gpa, .io = std.testing.io }, @@ -2101,7 +2101,7 @@ test "mac worker setup failures finish matching LSP and pipe requests" { .threaded = undefined, .io = failing_io, .core = core, - .runtime = .{}, + .callbacks = .{}, .config_arena = .init(gpa), .prompt_rcs = .{}, .inbox = .{ .gpa = failing.allocator(), .lsp_allocator = failing.allocator(), .io = failing_io }, @@ -2224,7 +2224,7 @@ test "mac Restore keeps host state and rejects callbacks from the old core" { .threaded = undefined, .io = std.testing.io, .core = core, - .runtime = .{}, + .callbacks = .{}, .config_arena = .init(gpa), .prompt_rcs = .{}, .inbox = .{ .gpa = gpa, .lsp_allocator = gpa, .io = std.testing.io }, @@ -2325,7 +2325,7 @@ test "mac Restore cancels a PTY reader waiting for output capacity" { .threaded = undefined, .io = io, .core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }), - .runtime = .{}, + .callbacks = .{}, .config_arena = .init(gpa), .prompt_rcs = .{}, .inbox = .{ .gpa = gpa, .lsp_allocator = gpa, .io = io }, @@ -2627,7 +2627,7 @@ test "mac row metrics ABI preserves PDF cell dimensions and the unrendered grid" const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer core.deinit(); - state = .{ .gpa = gpa, .threaded = undefined, .io = std.testing.io, .core = core, .runtime = .{}, .config_arena = .init(gpa), .prompt_rcs = .{} }; + state = .{ .gpa = gpa, .threaded = undefined, .io = std.testing.io, .core = core, .callbacks = .{}, .config_arena = .init(gpa), .prompt_rcs = .{} }; defer { state.?.config_arena.deinit(); state = null; @@ -2646,7 +2646,7 @@ test "mac tag layer ABI preserves logical capacity and physical grip" { const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 8, .rows = 3 }); defer core.deinit(); - state = .{ .gpa = gpa, .threaded = undefined, .io = std.testing.io, .core = core, .runtime = .{}, .config_arena = .init(gpa), .prompt_rcs = .{} }; + state = .{ .gpa = gpa, .threaded = undefined, .io = std.testing.io, .core = core, .callbacks = .{}, .config_arena = .init(gpa), .prompt_rcs = .{} }; defer { for (state.?.tag_cells) |cells| gpa.free(cells); state.?.config_arena.deinit(); -- cgit v1.3 From 4887578ce82518c84ef76f7ee03748911f4f9933 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 15:12:36 -0300 Subject: core: the fields that hold a pane's slot and hand it to the entries are Pane.Id (P21: the fields, not the inner code): Pipe.PendingPipe.pane (usize; authority only, in no dump or digest), the LSP question's wait.pane (usize; dumped and digested: a byte where it was eight), Pardes.theme_file_pane (u8: the same byte) and colors.ThemeFileRequest.pane (u8); the 14 `.at(wait.pane)`, 7 `.at(w.pane)` and 4 `.at(request.pane)`/`.at(pane)` go, lspResponse takes the integer once for its nine integer readers (`asked`), and requestThemeFile stores `.at(id)` where it clamped a slot it had just reported on by MAX_PANES - 1 (the clamp and colors.zig's MAX_PANES go); the conversions by count.py (.at(, .index(), @intCast of a slot) fall: the core's code 440 -> 427, dev's and runtime's 120 -> 116; the other fields that hold a slot are left, each read as an integer more often than it is wrapped (View.active about +216 by the estimate, builtins' Ctx.id +108; the table in reports/pardes-slots.md); the compiler caught nothing (every use read first); the semantics word does not move (a73794ff9e03f814); the dump's table gives both fields a new kind, so a session restored from an older build's dump says once "a dump of another build: Core.theme_file_pane: its kind changed; its default taken" (and a dump made mid-question drops the question); gate on the stack through this change and the docking vocabulary (load 4-32): tui core-test 871/1028 (157 skipped), shell-test 1070/1073, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275 and --replay 275/275, consumer-test passes, addon-test 5/5, process-test 0 of 144 (tty boot: msg failed once at load 32 and passed alone), replicas --clients 5 and --bytes --clients 5: diverged 0, unequal 0, deltas wrong 0, quiet checks differed 0, unlisted stops 0, corpus 22 of 22, no leak; the semantics word a73794ff9e03f814 as on merge40; daemon.py --far, --games, --window-clients pass, plain fails 2 of 4 at "client C agrees with a shell's output" (a timeout), as merge40's build does 3 of 6; the macOS library (x86_64-linux, aarch64-macos, the ABI guard 2/2) and the FreeBSD cross-build build; frames 77/77, gui unit-test 1666/1670 (the perf check's BaselineHarnessMismatch), perfab corpus2x +0.054% (noise 0.054%), the 121 per-operation counts within 0.1% against tree2 (key-down on medium 10,039,720 and render on medium 11,454,636, merge40's gate 10,039,703 and 11,454,619) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/Core.zig | 2 +- core/Pipe.zig | 36 ++++++++++++++++++------------------ core/colors.zig | 7 +++---- core/lsp/Ask.zig | 39 ++++++++++++++++++++------------------- dev/file_watch.zig | 6 +++--- runtime/macos.zig | 2 +- 6 files changed, 46 insertions(+), 46 deletions(-) (limited to 'runtime/macos.zig') diff --git a/core/Core.zig b/core/Core.zig index ff704bc6..7c20c252 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -300,7 +300,7 @@ theme_file_path: config.Settings.Text(limits.host_path_cap) = .{}, /// what a failed ThemeFile goes back to (colors.revertThemeFile). theme_file_loaded: config.Settings.Text(limits.host_path_cap) = .{}, theme_file_generation: u32 = 0, -theme_file_pane: u8 = 0, +theme_file_pane: Pane.Id = .at(0), chrome: colors.ChromeTheme = colors.initial_chrome, /// Every drawn frame's timings (FrameStats: the Debug box, PARDES_FRAMES): /// its runner's (`Options.frames`), which its frontend writes as it draws diff --git a/core/Pipe.zig b/core/Pipe.zig index cf61b78f..012ce689 100644 --- a/core/Pipe.zig +++ b/core/Pipe.zig @@ -52,7 +52,7 @@ pub const PendingPipe = struct { /// The digest's walk (core/walk.zig) of the ranges, as far as they go. pub const replica = .{ .len = .{.{ "ranges", "nranges" }} }; id: u32, - pane: usize, + pane: Pane.Id, serial: u32, /// The text piped: the pane's body or tag, or a header (`column` /// names which). @@ -133,7 +133,7 @@ pub fn submitPipe(p: *Pardes, id: usize) void { if (p.pipe.wait) |*old| old.deinit(); p.pipe.wait = .{ .id = p.pipe.seq, - .pane = id, + .pane = .at(id), .serial = pane.serial, .what = t.what, .column = p.headerColumn() orelse 0, @@ -166,16 +166,16 @@ fn pipeFailed(p: *Pardes, wait: *const PendingPipe, failure: ?selection_pipe.Fai var out: std.Io.Writer.Allocating = .init(p.gpa); defer out.deinit(); const w = &out.writer; - w.print("| {s}\n\n", .{wait.command}) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + w.print("| {s}\n\n", .{wait.command}) catch |err| return p.reportError(wait.pane, "pipe", err); if (wait.inputs.len > 1) if (failure) |fail| - w.print("selection {d} of {d}: ", .{ fail.index + 1, wait.inputs.len }) catch |err| return p.reportError(.at(wait.pane), "pipe", err); - writeFailure(w, failure) catch |err| return p.reportError(.at(wait.pane), "pipe", err); - const content = out.toOwnedSlice() catch |err| return p.reportError(.at(wait.pane), "pipe", err); + w.print("selection {d} of {d}: ", .{ fail.index + 1, wait.inputs.len }) catch |err| return p.reportError(wait.pane, "pipe", err); + writeFailure(w, failure) catch |err| return p.reportError(wait.pane, "pipe", err); + const content = out.toOwnedSlice() catch |err| return p.reportError(wait.pane, "pipe", err); const was = p.view().active; - panes.Output.openErrors(p, wait.pane, content) catch |err| { + panes.Output.openErrors(p, wait.pane.index(), content) catch |err| { p.gpa.free(content); // Nowhere to put the report is itself worth one line. - p.reportError(.at(wait.pane), "pipe", err); + p.reportError(wait.pane, "pipe", err); return; }; if (p.panes[was] != null) p.view().active = was; @@ -250,7 +250,7 @@ pub fn pipeResponse( if (!success or outputs.len != wait.inputs.len) return pipeFailed(p, &wait, failure); - const pane = p.panes[wait.pane] orelse return; + const pane = p.panes[wait.pane.index()] orelse return; if (pane.serial != wait.serial) return; const t: *Text = switch (wait.what) { .body => &pane.body, @@ -259,13 +259,13 @@ pub fn pipeResponse( .workspace => &p.global_tag, .input => return, }; - const content = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + const content = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(wait.pane, "pipe", err); const changed = if (t.what == .body) changed: { const f = pane.file orelse return; if (!panes.Output.fileTraits(f.output).saves) return; break :changed f.revision != wait.revision; } else std.hash.Wyhash.hash(0, content) != wait.sum; - if (changed) return p.reportError(.at(wait.pane), "pipe", error.FileChangedWhileFiltering); + if (changed) return p.reportError(wait.pane, "pipe", error.FileChangedWhileFiltering); if (wait.how == .ignore) return; if (wait.how == .keep) { @@ -296,14 +296,14 @@ pub fn pipeResponse( const cut = pipeCut(&wait, content, i) orelse return; const output = pipeOutput(&wait, outputs, content, i); if (output.len > selection_pipe.max_stdout_bytes) - return p.setMessage(.at(wait.pane), std.fmt.bufPrint(&said, "pipe: an output of {d} bytes, past {d}: the text is left as it was", .{ output.len, selection_pipe.max_stdout_bytes }) catch unreachable); // two numbers fit 128 + return p.setMessage(wait.pane, std.fmt.bufPrint(&said, "pipe: an output of {d} bytes, past {d}: the text is left as it was", .{ output.len, selection_pipe.max_stdout_bytes }) catch unreachable); // two numbers fit 128 total_output += output.len; // each under 1 MiB, at most max_selections of them if (total_output > selection_pipe.max_total_stdout_bytes) - return p.setMessage(.at(wait.pane), std.fmt.bufPrint(&said, "pipe: {d} bytes of output in all, past {d}: the text is left as it was", .{ total_output, selection_pipe.max_total_stdout_bytes }) catch unreachable); // two numbers fit 128 - if (i > 0 and cut.lo < ops[i - 1].q1) return p.setMessage(.at(wait.pane), "pipe: the selections overlap: the text is left as it was"); + return p.setMessage(wait.pane, std.fmt.bufPrint(&said, "pipe: {d} bytes of output in all, past {d}: the text is left as it was", .{ total_output, selection_pipe.max_total_stdout_bytes }) catch unreachable); // two numbers fit 128 + if (i > 0 and cut.lo < ops[i - 1].q1) return p.setMessage(wait.pane, "pipe: the selections overlap: the text is left as it was"); ops[i] = .{ .q0 = @intCast(cut.lo), .q1 = @intCast(cut.hi), .text = output }; } - const replacement = sam.apply(p.gpa, content, ops[0..n]) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + const replacement = sam.apply(p.gpa, content, ops[0..n]) catch |err| return p.reportError(wait.pane, "pipe", err); var new_ranges: [panes.Text.max_selections]modal.Selection = undefined; var delta: isize = 0; for (ops[0..n], wait.ranges[0..n], new_ranges[0..n]) |op, range, *moved| { @@ -316,10 +316,10 @@ pub fn pipeResponse( // One async request is one history transaction, even at 64 cursors. edit.pushUndo(p.editor(), t) catch |err| { p.gpa.free(replacement); - return p.reportError(.at(wait.pane), "pipe", err); + return p.reportError(wait.pane, "pipe", err); }; - edit.setEditText(p.editor(), t, replacement) catch |err| return p.reportError(.at(wait.pane), "pipe", err); - const now = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + edit.setEditText(p.editor(), t, replacement) catch |err| return p.reportError(wait.pane, "pipe", err); + const now = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(wait.pane, "pipe", err); t.setRanges(p.settings.tab, now, new_ranges[0..n], &.{}, wait.primary, wait.explicit); t.select = false; t.show(p.settings.tab); diff --git a/core/colors.zig b/core/colors.zig index 4825ea3f..7e692fe5 100644 --- a/core/colors.zig +++ b/core/colors.zig @@ -8,7 +8,6 @@ const Color = @import("surface.zig").Color; const FontRole = @import("surface.zig").FontRole; const config = @import("config.zig"); const platform = pardes.platform; -const MAX_PANES = pardes.MAX_PANES; const BOX_H = pardes.BOX_H; const Pardes = pardes.Pardes; @@ -630,7 +629,7 @@ pub fn requestThemeFile(p: *Pardes, id: usize, argument: []const u8) void { p.reportError(.at(id), "theme file", error.PathTooLong); return; } - p.theme_file_pane = @intCast(@min(id, MAX_PANES - 1)); + p.theme_file_pane = .at(id); const generation = nextThemeFileGeneration(p); p.emit(.{ .theme_file = .{ .generation = generation, .on = true } }); } @@ -645,7 +644,7 @@ pub fn loadedThemeFile(p: *const Pardes) ?[]const u8 { pub const ThemeFileRequest = struct { path: []const u8, - pane: u8, + pane: pardes.Pane.Id, }; /// Borrow the current request while a native host performs its synchronous @@ -673,7 +672,7 @@ fn themeFileFailure(p: *Pardes, request: ThemeFileRequest, why: []const u8) void var said: pardes.Kind.Buf(520) = .{}; var cut: [200]u8 = undefined; const path = @import("ninep/tree.zig").fitErr(request.path, &cut); - p.reportFailure(request.pane, said.print("theme file {s}: {s}", .{ path, why })); + p.reportFailure(request.pane.index(), said.print("theme file {s}: {s}", .{ path, why })); revertThemeFile(p); } diff --git a/core/lsp/Ask.zig b/core/lsp/Ask.zig index 376b093d..500f02b5 100644 --- a/core/lsp/Ask.zig +++ b/core/lsp/Ask.zig @@ -29,7 +29,7 @@ last: ?struct { kind: lsp.Kind, arg: Effect.Buf(128), serial: u32, offset: u32 } wait: ?struct { id: u32, kind: lsp.Kind, - pane: usize, + pane: Pane.Id, serial: u32, revision: u32, arg: Effect.Buf(128), @@ -103,7 +103,7 @@ pub fn lspRequest(p: *Pardes, asked: usize, kind: lsp.Kind, arg_in: []const u8) p.lsp_ask.wait = .{ .id = p.lsp_ask.seq, .kind = kind, - .pane = id, + .pane = .at(id), .serial = pane.serial, .revision = if (pane.file) |f| f.revision else 0, .arg = .from(arg), @@ -270,24 +270,25 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { const w = p.lsp_ask.wait orelse return; if (w.id != id) return; // superseded by a newer press, or the pane died p.lsp_ask.wait = null; - const pane = p.panes[w.pane] orelse return; + const asked = w.pane.index(); + const pane = p.panes[asked] orelse return; if (pane.serial != w.serial) return; // Whatever fails from here -- no answer, nothing found, no room for // its pane -- fails a 9P write that asked it too. const failures = p.fs.failures; - defer if (p.fs.failures != failures) p.noteLateFailure(.at(w.pane)); + defer if (p.fs.failures != failures) p.noteLateFailure(w.pane); var said: pardes.Kind.Buf(256) = .{}; const rows = response orelse - return p.reportFailure(w.pane, said.print("{s}: the language server did not answer", .{lspWord(w.kind)})); + return p.reportFailure(asked, said.print("{s}: the language server did not answer", .{lspWord(w.kind)})); // A backend that cannot answer it says why (`@none `). if (std.mem.startsWith(u8, rows, "@none ")) { const why = std.mem.trimEnd(u8, rows["@none ".len..], "\n"); - return p.reportFailure(w.pane, said.print("{s}: {s}", .{ lspWord(w.kind), why })); + return p.reportFailure(asked, said.print("{s}: {s}", .{ lspWord(w.kind), why })); } // Index's answer is its indexer's command line, run in a command // pane (lsp_client.indexCommand). if (w.kind == .index) { - if (std.mem.startsWith(u8, rows, "@run ")) _ = exec.execute(p, w.pane, std.mem.trimEnd(u8, rows["@run ".len..], "\n")); + if (std.mem.startsWith(u8, rows, "@run ")) _ = exec.execute(p, asked, std.mem.trimEnd(u8, rows["@run ".len..], "\n")); return; } if (w.kind == .rename or w.kind == .format) { @@ -296,7 +297,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { if (applyLspEdits(p, pane, w.revision, edits)) { var buf: pardes.Kind.Buf(64) = .{}; const verb: []const u8 = if (w.kind == .rename) "renamed" else "formatted"; - p.setMessage(.at(w.pane), buf.print("{s} {d} range(s)", .{ verb, edits.len })); + p.setMessage(w.pane, buf.print("{s} {d} range(s)", .{ verb, edits.len })); } return; } @@ -308,19 +309,19 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { } if (rows.len == 0) { if (w.kind == .completion and pane.body.mode == .insert and pane.body.nsel == 0 and - pane.body.cur_row == w.row and pane.body.cur_col == w.col) edit.insertTab(p.editor(), &pane.body) catch |err| return p.reportError(.at(w.pane), "complete", err); + pane.body.cur_row == w.row and pane.body.cur_col == w.col) edit.insertTab(p.editor(), &pane.body) catch |err| return p.reportError(w.pane, "complete", err); // Nothing found fails, but for a file with no diagnostics, // which is no failure, and a completion's Tab. const none: ?[]const u8 = switch (w.kind) { .completion, .format => null, .rename => "nothing here to rename", - .diagnostics, .workspace_diagnostics => return p.setMessage(.at(w.pane), said.print("{s}: none", .{lspWord(w.kind)})), + .diagnostics, .workspace_diagnostics => return p.setMessage(w.pane, said.print("{s}: none", .{lspWord(w.kind)})), .incoming_calls => "callers not found", .outgoing_calls => "callees not found", .hover => "nothing to show: not found", else => "not found", }; - if (none) |text| p.reportFailure(w.pane, said.print("{s}: {s}", .{ lspWord(w.kind), text })); + if (none) |text| p.reportFailure(asked, said.print("{s}: {s}", .{ lspWord(w.kind), text })); return; } @@ -330,7 +331,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { const ln = std.mem.trimEnd(u8, rows, "\n"); const place = ln[0..panes.Output.location(ln).end]; p.look_missed = false; - look.lookAt(p, w.pane, place); + look.lookAt(p, asked, place); // The one place is the text's places, as a list's would be: tinted, // and n and N step it. const spot = look.parsePathLine(place); @@ -367,16 +368,16 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { }; if (listed) |source| if (pane.file != null and pane.query == null and !p.exec_header) { p.fs.refilled = null; - panes.Query.fillList(p, w.pane, source, rows); + panes.Query.fillList(p, asked, source, rows); p.fs.lsp_result = if (panes.Query.ofOwner(p, pane.serial)) |qid| p.panes[qid].?.serial else null; return; }; const dir = if (pane.file) |f| panes.Dir.ofName(f.path) else pane.cwdSlice(); - const content = p.gpa.dupe(u8, rows) catch |err| return p.reportError(.at(w.pane), lspWord(w.kind), err); + const content = p.gpa.dupe(u8, rows) catch |err| return p.reportError(w.pane, lspWord(w.kind), err); const serial_before = p.next_serial; p.fs.refilled = null; - panes.Output.fillResults(p, w.pane, dir, from, w.arg.slice(), content, null) catch |err| { - p.reportError(.at(w.pane), "language response", err); + panes.Output.fillResults(p, asked, dir, from, w.arg.slice(), content, null) catch |err| { + p.reportError(w.pane, "language response", err); return; }; if (rows.len >= 1 << 20) memory.trim(); @@ -390,7 +391,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { if (p.next_serial != serial_before) { const report_rows = std.mem.count(u8, result_pane.file.?.content, "\n"); const wanted: u16 = @intCast(@min(v.screen_h, report_rows + result_pane.tag_rows)); - layout.givePaneRows(p, result_id, wanted, w.pane); + layout.givePaneRows(p, result_id, wanted, asked); } look.focusPaneLine(p, result_id, .{ .line = 1, .col = 1 }, .keep); break; @@ -401,7 +402,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { // Rows that only name a file the server left alone (lsp_client // renameEdits) are no edits. const unrenamed = std.mem.count(u8, rows, ", which the server did not rename\n"); - p.setMessage(.at(w.pane), if (unrenamed > 0) + p.setMessage(w.pane, if (unrenamed > 0) said_buf.print("Rename: previewed, not applied: the server renamed in this file only, and {d} other open file(s) say the name", .{unrenamed}) else said_buf.print("Rename: {d} edit(s) across files, previewed, not applied", .{nrows})); @@ -413,7 +414,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { .line = @as(usize, @intCast(@max(0, w.row))) + 1, .col = @as(usize, @intCast(@max(0, w.col))) + 1, }); - _ = look.jumpResult(p, w.pane, row); + _ = look.jumpResult(p, asked, row); } } diff --git a/dev/file_watch.zig b/dev/file_watch.zig index c575f436..a0a500d7 100644 --- a/dev/file_watch.zig +++ b/dev/file_watch.zig @@ -611,12 +611,12 @@ pub fn applyThemeEffect( const pane = request.pane; const bytes = filesystem.readFile(&pardes.tape.none, gpa, request.path) catch |err| { colors.failThemeFile(core, generation, err); - core.noteLateFailure(.at(pane)); + core.noteLateFailure(pane); return false; }; defer gpa.free(bytes); if (!colors.loadThemeFile(core, generation, bytes)) { - core.noteLateFailure(.at(pane)); + core.noteLateFailure(pane); return false; } const hash = std.hash.Wyhash.hash(0, bytes); @@ -659,7 +659,7 @@ pub fn reloadTheme( live.generation = .{ .text = hash }; if (announce) { var msg_buf: [256]u8 = undefined; - core.setMessage(.at(request.pane), message.stamp(&msg_buf, "reloaded theme", request.path)); + core.setMessage(request.pane, message.stamp(&msg_buf, "reloaded theme", request.path)); } return false; } diff --git a/runtime/macos.zig b/runtime/macos.zig index 1954cfa5..88eab2bb 100644 --- a/runtime/macos.zig +++ b/runtime/macos.zig @@ -683,7 +683,7 @@ fn reloadWatchedTheme(st: *State, announce: bool) bool { live.retries_left = 0; if (announce) { var mbuf: [256]u8 = undefined; - st.core.setMessage(.at(request.pane), message.stamp(&mbuf, "reloaded theme", request.path)); + st.core.setMessage(request.pane, message.stamp(&mbuf, "reloaded theme", request.path)); } return true; } -- cgit v1.3