diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 22:02:15 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 22:06:24 -0300 |
| commit | 7d10ad68b07a7bbab23fa8565d39183e4387c478 (patch) | |
| tree | 5711e0680c6eb681a02965c17eb616265f189131 /src | |
| parent | 484841325bb35b0bb7c55f7980178388c4e39c71 (diff) | |
| download | pardes-7d10ad68b07a7bbab23fa8565d39183e4387c478.tar.gz pardes-7d10ad68b07a7bbab23fa8565d39183e4387c478.zip | |
words: `remote` out of the code where it meant a client (PARDES.md ruling 1: it meant any client, this machine's too): tui.zig's `Remote` is `Client` (the window's word already), `tui.remote` and `gui.remote` are `runClient`, `gui.remoteSession` is `clientSession`, `main.remoteAttach` is `attachClient`, the Shell's and Input's `remote` fields `client`, `fonts.remote` `fromSession` and the window's `remote_font_request` `session_font_request`; what a person reads: the window client's log "remote font is not installed here" is "the session's font is not installed here", attach's "no runtime directory to name the remote socket by" names the far socket; NOT renamed: the env var PARDES_REMOTE_RUNTIME (the user types it), 9p_io's error.Remote and RemoteError (a 9P peer's refusal), fs.zig's remote_path (a 9P mount's), tui.zig:86's terminal over ssh and :1579's shell over ssh, pty.zig's test prompt; names only, no logic moved; tui core-test 811/950 (139 skipped), shell-test 993/996, behaviour-test 269/273 (the four addon ABI tests the base fails), process-test 2 of 144 failed (lspcomplete and lspcompletemoved, the base's), daemon.py main passes; gui frame corpus 77/77 byte-identical against mbase, unit-test 1582/1590 (the base's 8 failures)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src')
| -rw-r--r-- | src/fonts.zig | 12 | ||||
| -rw-r--r-- | src/gui/gui.zig | 70 | ||||
| -rw-r--r-- | src/main.zig | 14 | ||||
| -rw-r--r-- | src/replica.zig | 4 | ||||
| -rw-r--r-- | src/tui/tui.zig | 40 |
5 files changed, 70 insertions, 70 deletions
diff --git a/src/fonts.zig b/src/fonts.zig index 84ce5307..540e3a60 100644 --- a/src/fonts.zig +++ b/src/fonts.zig @@ -76,9 +76,9 @@ pub fn list(arena: std.mem.Allocator, want_name: ?[]const u8) []const Font { return scan(arena, null, true); } -/// A remote config's absolute font path belongs to its machine. Resolve the -/// same face by name on this machine, retaining the filename as a fallback. -pub fn remote(arena: std.mem.Allocator, path: []const u8, name: []const u8) ?Font { +/// The session's config's absolute font path belongs to the session's machine. +/// Resolve the same face by name on this machine, retaining the filename as a fallback. +pub fn fromSession(arena: std.mem.Allocator, path: []const u8, name: []const u8) ?Font { if (name.len > 0) { const matches = list(arena, name); if (matches.len > 0) return matches[0]; @@ -421,7 +421,7 @@ test "the walk finds this machine's monospace faces" { } } -test "a remote font config resolves the installed face despite another machine's path" { +test "the session's font config resolves the installed face despite another machine's path" { var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); const alloc = arena.allocator(); @@ -429,8 +429,8 @@ test "a remote font config resolves the installed face despite another machine's if (installed.len == 0) return error.SkipZigTest; const face = installed[0]; const foreign = try std.fmt.allocPrint(alloc, "/other-machine/fonts/{s}", .{std.Io.Dir.path.basename(face.path)}); - const by_name = remote(alloc, foreign, face.name) orelse return error.MissingLocalFace; + const by_name = fromSession(alloc, foreign, face.name) orelse return error.MissingLocalFace; try std.testing.expectEqualStrings(face.path, by_name.path); - const by_file = remote(alloc, foreign, "") orelse return error.MissingLocalFace; + const by_file = fromSession(alloc, foreign, "") orelse return error.MissingLocalFace; try std.testing.expectEqualStrings(face.path, by_file.path); } diff --git a/src/gui/gui.zig b/src/gui/gui.zig index f78678c0..863bb81e 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -446,7 +446,7 @@ const Gui = struct { font_name_len: u8 = 0, /// A replica client's: the session's font request it last followed /// (syncReplicaFont), as a hash of the request. - remote_font_request: ?u64 = null, + session_font_request: ?u64 = null, px: f32, tagline_px: f32, tagline_percent: u8, @@ -578,7 +578,7 @@ fn acknowledgeGuiFont(g: *const Gui, core: *pardes.Pardes) void { } /// A replica client's font is the window's raster state: it follows the -/// session's request by the face's name on this machine (fonts.remote), +/// session's request by the face's name on this machine (fonts.fromSession), /// never acknowledging it or otherwise changing the replicated core. fn syncReplicaFont(g: *Gui, core: *const pardes.Pardes, gpa: std.mem.Allocator) bool { const f = &core.settings.font; @@ -590,12 +590,12 @@ fn syncReplicaFont(g: *Gui, core: *const pardes.Pardes, gpa: std.mem.Allocator) hash.update(name); hash.update(std.mem.asBytes(&f.requested_size_hundredths)); const request = hash.final(); - if (g.remote_font_request == request) return false; - g.remote_font_request = request; + if (g.session_font_request == request) return false; + g.session_font_request = request; var arena: std.heap.ArenaAllocator = .init(gpa); defer arena.deinit(); - const face = fonts.remote(arena.allocator(), path, name) orelse { - log.warn("remote font is not installed here: {s}", .{name}); + const face = fonts.fromSession(arena.allocator(), path, name) orelse { + log.warn("the session's font is not installed here: {s}", .{name}); return false; }; const bytes = filesystem.readFile(gpa, face.path) catch return false; @@ -768,8 +768,8 @@ pub fn run(init: std.process.Init, opts: pardes.Options, headless: bool) !void { /// `pardes-gui --attach=<socket>:<session>` (and `<host>:<session>`, /// through ssh, main.zig): this window a replica client of a session -/// elsewhere, as the tty's `remote` is a terminal's (`remoteSession`). -pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, session: []const u8, far: bool) !void { +/// elsewhere, as the tty's `runClient` is a terminal's (`clientSession`). +pub fn runClient(init: std.process.Init, opts: pardes.Options, path: []const u8, session: []const u8, far: bool) !void { return runNative(init, opts, false, .{ .path = path, .session = session, .far = far }); } @@ -963,7 +963,7 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, headless: bool, di // compositor moves it, as it does a title bar. if (!test_mode and !c.SDL_SetWindowHitTest(window, hitTest, &g)) log.warn("SDL_SetWindowHitTest: {s}", .{c.SDL_GetError()}); - if (dial) |to| return remoteSession(init, &g, opts_in, test_mode, to); + if (dial) |to| return clientSession(init, &g, opts_in, test_mode, to); try localSession(init, &g, opts_in, test_mode, headless); } @@ -1185,7 +1185,7 @@ fn localSession( } } -/// A window's link to a session elsewhere (`remoteSession`): what the +/// A window's link to a session elsewhere (`clientSession`): what the /// window's input made, fed to the replica once its own view is put back, /// and what the link's reader took off the stream. const Client = struct { @@ -1267,7 +1267,7 @@ const Client = struct { } /// Its own view drawn in the window, outside any step, as the tty's - /// client draws its terminal (tui.zig `Remote.draw`): what presenting + /// client draws its terminal (tui.zig `Client.draw`): what presenting /// writes in the core (a frame skipped, one owed) is put back. fn draw(cl: *Client, s: *Shell) void { const r = cl.link.r; @@ -1297,7 +1297,7 @@ fn clientReader(cl: *Client, fd: c_int, rest: *replica.Framer) void { } /// What the window does over its own view (`Replica.within`), its inputs -/// posted to the client (`Input.remote`): an SDL event dispatched, its size +/// posted to the client (`Input.client`): an SDL event dispatched, its size /// (the tagline's face too), the pointer under a frame that moved, the /// timedemo's and the test feed's steps. const OwnView = struct { @@ -1311,9 +1311,9 @@ const OwnView = struct { fn run(v: *OwnView, core: *pardes.Pardes) anyerror!void { if (v.sev) |sev| return dispatch(v.g, v.in, sev); const g = v.g; - if (syncReplicaFont(g, core, v.s.gpa)) v.s.remote.?.link.dirty = true; - if (scrollRows(g, v.in, v.s.gpa)) v.s.remote.?.link.dirty = true; - if (fitTaglineFont(g, core.settings.font.tagline_percent)) v.s.remote.?.link.dirty = true; + if (syncReplicaFont(g, core, v.s.gpa)) v.s.client.?.link.dirty = true; + if (scrollRows(g, v.in, v.s.gpa)) v.s.client.?.link.dirty = true; + if (fitTaglineFont(g, core.settings.font.tagline_percent)) v.s.client.?.link.dirty = true; const geom = windowCells(g); if (resizeOf(core.view(), geom.cols, geom.rows, g.cell_w, g.cell_h, g.tagline_width, g.tagline_height)) |ev| v.in.post(ev); if (v.pointer) refreshPresentedPointer(g, v.in); @@ -1328,9 +1328,9 @@ const OwnView = struct { /// is, a replica client of that session (docs/next-daemon.md, "Phase 6: GUI /// replica notes"). Its own core, loaded from the session's dump, applies /// its input at once (src/replica.zig) and draws its own view; the -/// session's units are the truth it rolls back to. The tty's `remote`, with +/// session's units are the truth it rolls back to. The tty's `runClient`, with /// a window for a terminal. -fn remoteSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_mode: bool, to: Dial) !void { +fn clientSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_mode: bool, to: Dial) !void { const io = init.io; const gpa = init.gpa; const Said = struct { @@ -1389,7 +1389,7 @@ fn remoteSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_ .inotify_fd = -1, .watches = &watches, .test_mode = test_mode, - .remote = &client, + .client = &client, }; g.no_blink = test_mode; defer g.hit_core = null; @@ -1399,7 +1399,7 @@ fn remoteSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_ // session let it go to upgrade. The window stays as it is. while (true) { const core = r.core(); - g.remote_font_request = null; + g.session_font_request = null; shell.core = core; shell.gview = joined.view; shell.surface = null; @@ -1417,7 +1417,7 @@ fn remoteSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_ log.warn("{s}", .{link.notice()}); } const reader = try std.Thread.spawn(.{}, clientReader, .{ &client, joined.fd, &joined.rest }); - var in: Input = .{ .core = core, .shell = &shell, .remote = &client }; + var in: Input = .{ .core = core, .shell = &shell, .client = &client }; // What it is, then its size, are its view's first inputs. link.input(.{ .frontend = .{ .windowed = true, .native_images = true, .native_image_patches = true } }); var drew = false; @@ -1757,13 +1757,13 @@ const Input = struct { core: *pardes.Pardes, /// The shell whose window this is (views.zig: its view is `gview`). shell: ?*Shell = null, - /// A replica client's (`remote`): its inputs go to its link, never + /// A replica client's (`runClient`): its inputs go to its link, never /// straight to the core, which only reads here. - remote: ?*Client = null, + client: ?*Client = null, quit: bool = false, fn post(in: *Input, ev: pardes.Event) void { - if (in.remote) |r| return r.post(ev); + if (in.client) |r| return r.post(ev); // The window's input is its own view's, a replica client's input // the session's last or not. if (in.shell) |s| if (s.core.live != s.gview) { @@ -1773,7 +1773,7 @@ const Input = struct { } fn close(in: *Input) void { - if (in.remote) |r| { + if (in.client) |r| { r.link.quit = true; in.quit = true; return; @@ -1810,7 +1810,7 @@ fn dispatch(g: *Gui, in: *Input, sev: *const c.SDL_Event) void { updateDisplayScale(g.window); // Underlines are drawn into the glyphs a logical pixel thick. resetGlyphAtlas(g); - if (in.remote) |r| { + if (in.client) |r| { r.link.dirty = true; } else in.core.needs_frame = true; }, @@ -1824,7 +1824,7 @@ fn dispatch(g: *Gui, in: *Input, sev: *const c.SDL_Event) void { c.SDL_EVENT_WINDOW_CLOSE_REQUESTED => in.close(), c.SDL_EVENT_WINDOW_FOCUS_GAINED => { in.post(.{ .focus = true }); - if (in.remote == null) upgrade.noticeNewer(in.core); + if (in.client == null) upgrade.noticeNewer(in.core); }, c.SDL_EVENT_WINDOW_FOCUS_LOST => in.post(.{ .focus = false }), c.SDL_EVENT_WINDOW_MOUSE_LEAVE => { @@ -2144,7 +2144,7 @@ fn wheelAt(g: *Gui, in: *Input, w: WheelTurn, mc: MouseCell) void { in.post(.{ .mouse = .{ .button = .wheel_down, .kind = .press, .col = mc.col, .row = mc.row, .tag_hit = mc.tag_hit, .body_hit = mc.body_hit, .ctrl = w.mods.ctrl, .shift = w.mods.shift, .alt = w.mods.alt } }); while (g.program_wheel <= -1) : (g.program_wheel += 1) in.post(.{ .mouse = .{ .button = .wheel_up, .kind = .press, .col = mc.col, .row = mc.row, .tag_hit = mc.tag_hit, .body_hit = mc.body_hit, .ctrl = w.mods.ctrl, .shift = w.mods.shift, .alt = w.mods.alt } }); - } else if (in.remote != null) { + } else if (in.client != null) { // A replica client's notch is whole rows at once, with no // glide; a touchpad's fraction is the window's picture // (scrollRows), its whole rows ordinary inputs. @@ -2204,7 +2204,7 @@ const WheelTurn = struct { x: f32 = 0, y: f32 = 0, integer_y: i32 = 0, precise: fn setFontPx(g: *Gui, in: *Input, want: f32) void { if (want == g.px) return; g.px = want; - if (in.remote) |r| { + if (in.client) |r| { refitFont(g, null); r.link.dirty = true; } else { @@ -2417,8 +2417,8 @@ const Shell = struct { gview: u8 = 0, /// Upgrade was asked from this pane, to be done between steps (`upgradeNow`). upgrade_asked: ?u8 = null, - /// This window a replica client of a session elsewhere (`remote`). - remote: ?*Client = null, + /// This window a replica client of a session elsewhere (`runClient`). + client: ?*Client = null, /// The session's replica clients (src/replica.zig), on sockets: views /// of their own with no window here. peers: replica.Peers = .{}, @@ -3179,7 +3179,7 @@ fn present(ctx: ?*anyopaque, surface: *const pardes.Surface) void { const s = shellOf(ctx); const core = s.core; // A replica client draws outside the pump, which marks it there. - if (s.remote != null) core.frames.mark_render = pardes.FrameStats.nowNs(); + if (s.client != null) core.frames.mark_render = pardes.FrameStats.nowNs(); const g = s.gui orelse return; frame_started_ns = monoNs(); const frame = surface; @@ -3731,7 +3731,7 @@ fn scrollRows(g: *Gui, in: *Input, gpa: std.mem.Allocator) bool { }); // A replica client's rows apply after its view is parked again: // its scroll has not moved yet. - if (in.remote == null and pane.scroll() == was) { + if (in.client == null and pane.scroll() == was) { resetScroll(g); return false; } @@ -3741,7 +3741,7 @@ fn scrollRows(g: *Gui, in: *Input, gpa: std.mem.Allocator) bool { // the last one, a fraction of a row off, and the next turn's frame // jumps from there (against the turn when it reverses). const moved = st.rows != 0 or st.lag != g.scroll_lag; - if (moved and in.remote == null) core.needs_frame = true; + if (moved and in.client == null) core.needs_frame = true; g.scroll_lag = st.lag; g.scroll_rect = r; const body_y = core.bodyTop(pane, r); @@ -7980,7 +7980,7 @@ test "trackpad rotation never types search keys into an insert-mode file or raw _ = try core.setTestFile("unchanged\n"); var client: Client = .{ .link = undefined, .io = std.testing.io, .gpa = gpa, .texts = .init(gpa) }; defer client.deinit(); - var in: Input = .{ .core = core, .remote = &client }; + var in: Input = .{ .core = core, .client = &client }; var g: Gui = undefined; g.trackpad = .{}; var ev: c.UITrackpadEvent = std.mem.zeroes(c.UITrackpadEvent); @@ -8049,7 +8049,7 @@ test "detached trackpad scrolling keeps fractions local and queues whole rows fo _ = try core.render(arena.allocator()); var client: Client = .{ .link = undefined, .io = std.testing.io, .gpa = gpa, .texts = .init(gpa) }; defer client.deinit(); - var in: Input = .{ .core = core, .remote = &client }; + var in: Input = .{ .core = core, .client = &client }; const id = core.view().active; const r = core.view().rects[id]; var g: Gui = undefined; diff --git a/src/main.zig b/src/main.zig index 2934aba9..4a55695c 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1496,7 +1496,7 @@ fn nativeMain(std_init: std.process.Init) !void { opts.recent_import = oldRecentDir(arena, init.environ_map); if (found.dir) |d| @import("crash.zig").setDir(d); if (attach) |name| if (std.mem.lastIndexOfScalar(u8, name, ':')) |colon| { - remoteAttach(init, opts, name[0..colon], name[colon + 1 ..]); + attachClient(init, opts, name[0..colon], name[colon + 1 ..]); }; if (attach) |name| if (!resuming) attachTo(init, opts, name); if (detach) |name| { @@ -1674,17 +1674,17 @@ fn commOf(io: std.Io, pid: []const u8, buf: *[64]u8) []const u8 { /// window's (gui.zig). fn clientOf(init: std.process.Init, opts: pardes.Options, path: []const u8, name: []const u8, far: bool) !void { switch (pardes.platform) { - .tui => try @import("tui/tui.zig").remote(init, opts, path, name, far), - .gui => try @import("gui/gui.zig").remote(init, opts, path, name, far), + .tui => try @import("tui/tui.zig").runClient(init, opts, path, name, far), + .gui => try @import("gui/gui.zig").runClient(init, opts, path, name, far), else => unreachable, } } /// `pardes --attach=<where>:<name>` (`pardes-gui` too): a replica client -/// (tui.zig and gui.zig `remote`), through the socket `where` names, or +/// (tui.zig and gui.zig `runClient`), through the socket `where` names, or /// through `ssh -L` of host `where`'s replica socket to one of this /// process's. -fn remoteAttach(init: std.process.Init, opts: pardes.Options, where: []const u8, name: []const u8) noreturn { +fn attachClient(init: std.process.Init, opts: pardes.Options, where: []const u8, name: []const u8) noreturn { const io = init.io; if (comptime pardes.platform != .tui and pardes.platform != .gui) unreachable; if (std.mem.indexOfScalar(u8, where, '/') != null) { @@ -1697,7 +1697,7 @@ fn remoteAttach(init: std.process.Init, opts: pardes.Options, where: []const u8, const here = std.fmt.bufPrintSentinel(&here_buf, "{s}/pardes-ssh-{d}.sock", .{ tmp, std.c.getpid() }, 0) catch die(io, "--attach: TMPDIR is too long for a socket's path", .{}); var there_buf: [ninep_io.sun_path_len + 64:0]u8 = undefined; var dir_buf: [ninep_io.sun_path_len:0]u8 = undefined; - const dir = if (std.c.getenv("PARDES_REMOTE_RUNTIME")) |d| std.mem.span(d) else ninep_io.socketDir(&dir_buf) orelse die(io, "--attach: no runtime directory to name the remote socket by: set PARDES_REMOTE_RUNTIME", .{}); + const dir = if (std.c.getenv("PARDES_REMOTE_RUNTIME")) |d| std.mem.span(d) else ninep_io.socketDir(&dir_buf) orelse die(io, "--attach: no runtime directory to name the far socket by: set PARDES_REMOTE_RUNTIME", .{}); var forward_buf: [2 * ninep_io.sun_path_len + 64]u8 = undefined; const there = std.fmt.bufPrintSentinel(&there_buf, "{s}/pardes-replica.sock", .{dir}, 0) catch unreachable; const forward = std.fmt.bufPrintSentinel(&forward_buf, "{s}:{s}", .{ here, there }, 0) catch unreachable; @@ -1814,7 +1814,7 @@ fn attachTo(init: std.process.Init, opts: pardes.Options, name: []const u8) nore fn crossAttach(init: std.process.Init, opts: pardes.Options, name: []const u8) noreturn { var sock_buf: [ninep_io.sun_path_len:0]u8 = undefined; const sock = daemon.replicaSocket(&sock_buf) orelse die(init.io, "--attach: no runtime directory for the replica socket", .{}); - remoteAttach(init, opts, sock, name); + attachClient(init, opts, sock, name); } /// Where Recent's file (0.24) and the store before it were kept: diff --git a/src/replica.zig b/src/replica.zig index 5513b2d9..32c8acd7 100644 --- a/src/replica.zig +++ b/src/replica.zig @@ -2726,7 +2726,7 @@ pub fn readLink(gpa: Allocator, fd: c_int, rest: *Framer, ctx: anytype, comptime const upgrade_words = "session upgraded to a newer pardes: upgrade this client too"; /// A replica client's join, the terminal's and the window's alike (their -/// `remote`): the session at `path` dialled, its build checked to be this +/// `runClient`): the session at `path` dialled, its build checked to be this /// one's, and its dump loaded into a replica checked against the session /// as it was dumped. Or, `old` given, joined again once old's link has /// ended, for old's view (`redial`): the core it leaves held meanwhile so @@ -2807,7 +2807,7 @@ fn redial(gpa: Allocator, path: []const u8, session: []const u8, why: *[600]u8, } /// A replica client's link to its session, the terminal's (tui.zig -/// `remote`) and the window's (gui.zig `remote`): its replica, its socket, +/// `runClient`) and the window's (gui.zig `runClient`): its replica, its socket, /// what the session said, and what it checks. Drawing is the frontend's. pub const Link = struct { r: *Replica, diff --git a/src/tui/tui.zig b/src/tui/tui.zig index ce2dc84a..7aebeb7a 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -619,15 +619,15 @@ pub fn run(init: std.process.Init, opts: pardes.Options, term: Term) !void { try localSession(init, opts, &screen, &loop, &paste_buf); } -/// A replica client's link to its session (`remote`), drawn here. -const Remote = struct { +/// A replica client's link to its session (`runClient`), drawn here. +const Client = struct { link: replica.Link, /// The client's own view drawn on its terminal, outside any step: the /// replica's digest stays the session's (views.drawOne). What the host /// writes in the core as it presents (a frame skipped, one owed) is put /// back, as the frame statistics are this process's. - fn draw(c: *Remote, s: *Shell) void { + fn draw(c: *Client, s: *Shell) void { const r = c.link.r; const core = r.core(); const skipped = core.present_skipped; @@ -664,7 +664,7 @@ fn linkReader(gpa: std.mem.Allocator, fd: posix.fd_t, rest: *replica.Framer, loo /// from the session's dump, applies its keys at once (src/replica.zig); /// the session's units are the truth it rolls back to. Its own view of the /// session is drawn here, as the session draws its terminals'. -pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, session: []const u8, far_link: bool) !void { +pub fn runClient(init: std.process.Init, opts: pardes.Options, path: []const u8, session: []const u8, far_link: bool) !void { const io = init.io; const gpa = init.gpa; const Said = struct { @@ -718,8 +718,8 @@ pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, se var loop: Loop = .init(io, &screen.tty, &screen.vx); var frame_arena: std.heap.ArenaAllocator = .init(allocs.frame); defer frame_arena.deinit(); - var remote_link: Remote = .{ .link = .{ .r = r, .fd = joined.fd } }; - const link = &remote_link.link; + var client_link: Client = .{ .link = .{ .r = r, .fd = joined.fd } }; + const link = &client_link.link; try link.fromEnv(gpa, init.environ_map); defer link.deinit(gpa); var sh: Shell = .{ @@ -734,7 +734,7 @@ pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, se .inotify_fd = -1, .own = joined.view, .screen = &screen, - .remote = &remote_link, + .client = &client_link, }; try startInput(&loop, &screen); @@ -758,7 +758,7 @@ pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, se while (!link.quit) { // Its predicted echo judged and caught up, once a frame. if (r.echoFrame()) link.dirty = true; - if (link.dirty) remote_link.draw(&sh); + if (link.dirty) client_link.draw(&sh); // The tty's own motions (its glide, a jump's trail) drawn a frame // a tick while they move, as waitInput wakes the local loop: a // wheel's glide was drawn only at the next event. After the @@ -1244,14 +1244,14 @@ const Shell = struct { took_input: bool = false, took_output: bool = false, held: ?Msg = null, - /// This process a replica client of a session elsewhere (`remote`): + /// This process a replica client of a session elsewhere (`runClient`): /// its inputs go to the replica, never straight to the core. - remote: ?*Remote = null, + client: ?*Client = null, /// A terminal's input, to the core, or to a replica client's engine /// (applied at once there, and sent to the session). fn feed(s: *Shell, ev: pardes.Event) void { - const c = s.remote orelse return s.core.update(ev); + const c = s.client orelse return s.core.update(ev); c.link.input(ev); } @@ -1413,7 +1413,7 @@ const Shell = struct { /// A client's own build is not the session's to say (its core's host /// is the session's, through the tape). fn newerBuild(ctx: ?*anyopaque) bool { - return of(ctx).remote == null and upgrade.newer(); + return of(ctx).client == null and upgrade.newer(); } fn upgradeAsked(ctx: ?*anyopaque, pane: u8) void { @@ -1687,7 +1687,7 @@ const Shell = struct { // The terminal's input goes into its view. switch (event) { .key_press, .mouse, .paste, .paste_start, .paste_end, .winsize, .focus_in, .focus_out, .quit => { - if (s.local() and s.remote == null) core.toView(s.own); + if (s.local() and s.client == null) core.toView(s.own); }, else => {}, } @@ -1704,7 +1704,7 @@ const Shell = struct { virtual.* = @max(virtual.*, s.wake_to); }, .quit => { - if (s.remote) |c| { + if (s.client) |c| { c.link.quit = true; return true; } @@ -1727,14 +1727,14 @@ const Shell = struct { s.input_seen = true; }, .replica_mail => s.input_seen = true, - .said => |said| if (s.remote) |c| { + .said => |said| if (s.client) |c| { c.link.take(said); if (said == .refused) return true; } else switch (said) { .unit, .screen, .refused => |b| std.heap.c_allocator.free(b), .checked => {}, }, - .link_gone => if (s.remote) |c| { + .link_gone => if (s.client) |c| { c.link.quit = true; c.link.gone = true; return true; @@ -1851,7 +1851,7 @@ const Shell = struct { if (!sc.on or sc.vx.state.in_band_resize) return; const ws = sc.tty.getWinsize() catch return; if (sc.size) |was| if (std.meta.eql(was, ws)) return; - if (s.remote == null) s.core.toView(s.own); + if (s.client == null) s.core.toView(s.own); s.resized(sc, ws); } @@ -1924,7 +1924,7 @@ const Shell = struct { const trail_on = s.core.settings.jump_trail and truecolor; const shown = trailCells(s.frame.allocator(), glided, &sc.trail, trail_on, now) catch glided; paintCells(win, shown.cells, shown.cols, shown.rows); - if (s.remote) |c| if (c.link.notice_len > 0) noticeLine(win, c.link.notice(), shown.cols, shown.rows); + if (s.client) |c| if (c.link.notice_len > 0) noticeLine(win, c.link.notice(), shown.cols, shown.rows); tz_cells.end(); if (vx.caps.kitty_graphics) for (canonical.placements.items) |place| { if (place.art.glyph or !kittyImageRepresentable(place)) continue; @@ -2253,7 +2253,7 @@ fn watchFiles(io: std.Io, fd: c_int, loop: *Loop) void { fn keepSignal(_: posix.SIG) callconv(.c) void {} -/// A replica client's (`remote`): a hangup is its end, whoever sent it. +/// A replica client's (`runClient`): a hangup is its end, whoever sent it. var hangup_quits = false; fn winchWatch(loop: *Loop) void { @@ -2400,7 +2400,7 @@ pub fn cellOf(v: i16) u16 { return @intCast(@max(0, v)); } -/// A replica client's own line over its frame's last row (`Remote.notify`), +/// A replica client's own line over its frame's last row (`Client.notify`), /// reversed. `text` is printable ASCII and outlives the render (vaxis keeps /// the slices). fn noticeLine(win: vaxis.Window, text: []const u8, cols: u16, rows: u16) void { |
