╭ changed ────────╮ │src/serve_ssh.zig│ ╰─────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │39 pub fn handleSession(self: *const SessionHandler, sess: *ssh.SessionCtx, request: ssh.Request) !void { │ │40 serve_common.logError(sess.conn.io, self.err, "ssh session: kind={s} key={s}\n", .{ @tagName(request), sess.fingerprint });│ │41 switch (request) { │ │42 - .shell => |pty_maybe| { │ │43 - const pty = pty_maybe orelse { │ │42 + .shell => |shell| { │ │43 + const pty = shell.pty orelse { │ │44 // a shell without a pty has no useful TUI to render; in │ │45 // openssh client terms this is `ssh -T host`. say so and │ │46 // exit non-zero. │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────╮ │49 return; │ │50 }; │ │51 sess.exemptFromIdleTimeout(); │ │52 - try runTuiSession(self, sess, pty); │ │52 + try runTuiSession(self, sess, pty, shell.color);│ │53 }, │ │54 .exec => |exec| { │ │55 try runGitSession(self, sess, exec); │ ╰────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │194 } │ │195 }; │ │196 │ │197 -fn runTuiSession(handler: *const SessionHandler, sess: *ssh.SessionCtx, pty: ssh.PtySize) !void { │ │197 +fn runTuiSession(handler: *const SessionHandler, sess: *ssh.SessionCtx, pty: ssh.PtySize, color: bool) !void {│ │198 // runTui owns the terminal, whose deinit restores the client's screen and │ │199 // runs as the function unwinds — so any error it returns leaves the TUI torn │ │200 // down and we can surface the failure on the restored screen before exiting. │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │201 - runTui(handler, sess, pty) catch |tui_err| { │ │201 + runTui(handler, sess, pty, color) catch |tui_err| { │ │202 const err = sess.underlyingError(tui_err); │ │203 serve_common.logError(sess.conn.io, handler.err, "ssh tui session failed: {s}\n", .{@errorName(err)});│ │204 var buf: [256]u8 = undefined; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │208 }; │ │209 } │ │210 │ │211 -fn runTui(handler: *const SessionHandler, sess: *ssh.SessionCtx, pty: ssh.PtySize) !void { │ │211 +fn runTui(handler: *const SessionHandler, sess: *ssh.SessionCtx, pty: ssh.PtySize, color: bool) !void {│ │212 const allocator = sess.conn.allocator; │ │213 const io = sess.conn.io; │ │214 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────╮ │229 defer repo.deinit(io, allocator); │ │230 var ui_session = try ui.Session.init(&session_arena, &repo, .{});│ │231 ui_session.is_terminal = true; │ │232 + ui_session.color = color; │ │233 ui_session.web_port = handler.wui_port; │ │234 ui_session.data.git_http_port = handler.git_http_port; │ │235 ui_session.data.git_ssh_port = handler.git_ssh_port; │ ╰──────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────╮ │253 │ │254 // initial render — user sees the page immediately│ │255 if (terminal_maybe) |*terminal| { │ │256 + terminal.render_state.no_color = !color; │ │257 try terminal.queryBackground(); │ │258 _ = try terminal.render(&nav.root); │ │259 } │ ╰───────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │271 } else { │ │272 // the copyable text stays up until enter │ │273 if (std.mem.indexOfAny(u8, payload, "\r\n") == null) continue; │ │272 - terminal_maybe = try StreamTerminal.init(allocator, &session_writer.interface, terminal_size);│ │274 + var terminal = try StreamTerminal.init(allocator, &session_writer.interface, terminal_size); │ │275 + terminal.render_state.no_color = !color; │ │276 + terminal_maybe = terminal; │ │277 } │ │278 }, │ │279 .resize => |sz| { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯