From 2c81bbc08b0d0248af205b7e2c91a52875bab8d0 Mon Sep 17 00:00:00 2001 From: Teigen Date: Wed, 17 Jun 2026 23:19:54 +0800 Subject: [PATCH] feat(terminal): add forced redraw resize --- src/session.ts | 5 +++-- src/web/public/index.html | 8 ++++++++ src/web/public/settings-ui.js | 11 ++++++++++- src/web/public/terminal-ui.js | 19 ++++++++++++------- src/web/routes/session-routes.ts | 8 ++------ src/web/routes/ws-routes.ts | 9 +++------ src/web/schemas.ts | 2 ++ test/routes/session-routes.test.ts | 16 ++++++++++++++-- test/routes/ws-routes.test.ts | 23 +++++++++++++++++++---- test/session-resize-arbitration.test.ts | 9 +++++++++ 10 files changed, 82 insertions(+), 28 deletions(-) diff --git a/src/session.ts b/src/session.ts index d4746e77..6b115bc3 100644 --- a/src/session.ts +++ b/src/session.ts @@ -2321,7 +2321,7 @@ export class Session extends EventEmitter { * @param cols - Number of columns (width in characters) * @param rows - Number of rows (height in lines) */ - resize(cols: number, rows: number, options: { viewportType?: ResizeViewportType } = {}): void { + resize(cols: number, rows: number, options: { viewportType?: ResizeViewportType; force?: boolean } = {}): void { const isSmallViewport = options.viewportType === 'mobile' || options.viewportType === 'tablet'; if (options.viewportType === 'desktop') { this._lastDesktopDims = { cols, rows }; @@ -2334,7 +2334,8 @@ export class Session extends EventEmitter { } this._mobileSizeOverride = true; } - if (this.ptyProcess && (cols !== this._ptyCols || rows !== this._ptyRows)) { + const dimsChanged = cols !== this._ptyCols || rows !== this._ptyRows; + if (this.ptyProcess && (dimsChanged || options.force)) { this._ptyCols = cols; this._ptyRows = rows; if (this._mux && this._muxSession) { diff --git a/src/web/public/index.html b/src/web/public/index.html index dc9ac53e..4c4c7734 100644 --- a/src/web/public/index.html +++ b/src/web/public/index.html @@ -116,6 +116,7 @@ -- +