diff options
Diffstat (limited to 'dev/tui/tui.zig')
| -rw-r--r-- | dev/tui/tui.zig | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/dev/tui/tui.zig b/dev/tui/tui.zig index 7e5a75fb..92ac6a0c 100644 --- a/dev/tui/tui.zig +++ b/dev/tui/tui.zig @@ -738,14 +738,23 @@ pub fn runClient(init: std.process.Init, opts: pardes.Options, path: []const u8, if (comptime builtin.os.tag == .freebsd) posix.sigaction(.WINCH, &.{ .handler = .{ .handler = keepSignal }, .mask = posix.sigemptyset(), .flags = 0 }, null); posix.sigprocmask(posix.SIG.BLOCK, &winch_set, null); - var start: client_loop.Start = undefined; - if (!start.open(init, opts, .{ .path = path, .session = session, .far = far_link })) Said.no(io, "{s}", .{start.said()}); - defer start.close(); var tty_buf: [0x10000]u8 = undefined; var screen: Screen = .{ .io = io, .gpa = gpa, .env = init.environ_map, .buf = &tty_buf, .kitty = .init(gpa) }; defer screen.kitty.deinit(); - try screen.enter(try vaxis.Tty.init(io, &tty_buf)); + // A pair's terminal is its own before its join, as the own frontend's + // is before its core: that join is the pair's whole start (its own + // boot, replica.ownBoot), and keys typed meanwhile are its input, not + // echoed by the line discipline and lost as it enters. An attach enters + // once joined, a refusal said on the terminal as it was. + if (opts.pair != null) try screen.enter(try vaxis.Tty.init(io, &tty_buf)); defer screen.leave(); + var start: client_loop.Start = undefined; + if (!start.open(init, opts, .{ .path = path, .session = session, .far = far_link })) { + screen.leave(); + Said.no(io, "{s}", .{start.said()}); + } + defer start.close(); + if (opts.pair == null) try screen.enter(try vaxis.Tty.init(io, &tty_buf)); defer screen.glide.deinit(gpa); defer screen.art.deinit(gpa); var paste_buf: std.Io.Writer.Allocating = .init(gpa); @@ -1631,9 +1640,12 @@ const Shell = struct { return false; } - /// Terminal `screen` (its view live) is `ws` big. + /// Terminal `screen` (its view live) is `ws` big; the size it has is no + /// resize (a client's start takes its size before its input thread's + /// first one comes: Tty.start). fn resized(s: *Shell, screen: ?*Screen, ws: vaxis.Winsize) void { if (screen) |sc| { + if (sc.size) |was| if (std.meta.eql(was, ws)) return; sc.size = ws; sc.vx.resize(s.gpa, sc.tty.writer(), ws) catch {}; } |
