From 25269cad3fdb8ae7758553e4e135ab8873d04006 Mon Sep 17 00:00:00 2001 From: Yaojia Wang Date: Thu, 18 Jun 2026 07:39:29 +0200 Subject: [PATCH] fix(ui): drop in-terminal Connecting/Connected/reconnecting lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tab connection dot (green/amber/red) already shows connection state, so the '[terminal] Connecting…/Connected' and 'Disconnected — reconnecting' lines just cluttered the scrollback. Rely on the dot; keep only the actionable exit message. --- public/terminal-session.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/public/terminal-session.ts b/public/terminal-session.ts index 2ec5731..e58709d 100644 --- a/public/terminal-session.ts +++ b/public/terminal-session.ts @@ -19,9 +19,7 @@ import { folderFromTitle, cwdFromOsc7 } from './title-util.js' const RESET = '\x1b[0m' const BOLD = '\x1b[1m' const DIM = '\x1b[2m' -const YELLOW = '\x1b[33m' const RED = '\x1b[31m' -const GREEN = '\x1b[32m' const CYAN = '\x1b[36m' function statusLine(msg: string): string { @@ -195,16 +193,14 @@ export class TerminalSession { connect(): void { if (this.disposed || this.isConnecting) return this.isConnecting = true - this.setStatus('connecting') - this.term.write(statusLine(`${YELLOW}Connecting…${RESET}`)) + this.setStatus('connecting') // connection state shows on the tab dot, not in the terminal const socket = new WebSocket(buildWsUrl()) this.ws = socket socket.addEventListener('open', () => { this.reconnectDelay = 1000 - this.setStatus('connected') - this.term.write(statusLine(`${GREEN}${BOLD}Connected${RESET}`)) + this.setStatus('connected') // tab dot turns green; no in-terminal "Connected" line // Send cwd only on a fresh session (M6 "new tab here"); on reconnect the // sessionId is already set and the server ignores cwd. const attachMsg: ClientMessage = @@ -282,12 +278,9 @@ export class TerminalSession { private scheduleReconnect(): void { if (this.reconnectTimer !== null) return - this.setStatus('reconnecting') + this.setStatus('reconnecting') // amber tab dot signals it; no in-terminal line const delay = this.reconnectDelay this.reconnectDelay = Math.min(this.reconnectDelay * 2, 30_000) - this.term.write( - statusLine(`${YELLOW}Disconnected — reconnecting in ${(delay / 1000).toFixed(0)}s…${RESET}`), - ) this.reconnectTimer = setTimeout(() => { this.reconnectTimer = null this.connect()