summaryrefslogtreecommitdiff
path: root/src/tui
diff options
context:
space:
mode:
Diffstat (limited to 'src/tui')
-rw-r--r--src/tui/tui.zig40
1 files changed, 20 insertions, 20 deletions
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 {