From d844d76b463d3c4f91fd7d3195c7d5bbe4566073 Mon Sep 17 00:00:00 2001 From: Rohit Kushwaha Date: Fri, 5 Jun 2026 16:52:32 +0530 Subject: [PATCH 1/3] fix: terminal resize --- src/components/terminal/terminalManager.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/terminal/terminalManager.js b/src/components/terminal/terminalManager.js index 5f2d0d1ce..eba0f6ccd 100644 --- a/src/components/terminal/terminalManager.js +++ b/src/components/terminal/terminalManager.js @@ -668,8 +668,9 @@ class TerminalManager { const RESIZE_DEBOUNCE = 200; let lastResizeTime = 0; - let lastWidth = 0; - let lastHeight = 0; + let lastWidth = null; + let lastHeight = null; + let isObserving = false; const handleResize = (entries) => { const now = Date.now(); const entry = entries && entries[0]; @@ -677,6 +678,21 @@ class TerminalManager { const width = cr?.width ?? terminalFile.content?.clientWidth ?? 0; const height = cr?.height ?? terminalFile.content?.clientHeight ?? 0; + // Skip resize events when container is hidden + const isHidden = + terminalFile.content?.style.display === "none" || + terminalFile.content?.offsetHeight === 0; + if (isHidden) { + return; + } + + if (lastWidth === null || lastHeight === null) { + lastWidth = width; + lastHeight = height; + isObserving = true; + return; + } + // Clear any pending resize if (resizeTimeout) { clearTimeout(resizeTimeout); From c65fb510bf34bda3bea220a0f4171c9fb14f7096 Mon Sep 17 00:00:00 2001 From: Rohit Kushwaha Date: Fri, 5 Jun 2026 17:05:54 +0530 Subject: [PATCH 2/3] fix: terminal resize --- src/components/terminal/terminalManager.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/terminal/terminalManager.js b/src/components/terminal/terminalManager.js index eba0f6ccd..f82c8fead 100644 --- a/src/components/terminal/terminalManager.js +++ b/src/components/terminal/terminalManager.js @@ -670,7 +670,7 @@ class TerminalManager { let lastWidth = null; let lastHeight = null; - let isObserving = false; + const handleResize = (entries) => { const now = Date.now(); const entry = entries && entries[0]; @@ -678,9 +678,9 @@ class TerminalManager { const width = cr?.width ?? terminalFile.content?.clientWidth ?? 0; const height = cr?.height ?? terminalFile.content?.clientHeight ?? 0; - // Skip resize events when container is hidden + // Skip resize events when container is hidden (via any method: inline style, CSS class, etc.) const isHidden = - terminalFile.content?.style.display === "none" || + getComputedStyle(terminalFile.content).display === "none" || terminalFile.content?.offsetHeight === 0; if (isHidden) { return; @@ -689,7 +689,7 @@ class TerminalManager { if (lastWidth === null || lastHeight === null) { lastWidth = width; lastHeight = height; - isObserving = true; + return; } From ddbb6511abfcb6811813e6969793caabdd3a0246 Mon Sep 17 00:00:00 2001 From: Rohit Kushwaha Date: Fri, 5 Jun 2026 17:06:39 +0530 Subject: [PATCH 3/3] format --- src/components/terminal/terminalManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/terminal/terminalManager.js b/src/components/terminal/terminalManager.js index f82c8fead..f9d22dd2d 100644 --- a/src/components/terminal/terminalManager.js +++ b/src/components/terminal/terminalManager.js @@ -670,7 +670,7 @@ class TerminalManager { let lastWidth = null; let lastHeight = null; - + const handleResize = (entries) => { const now = Date.now(); const entry = entries && entries[0]; @@ -689,7 +689,7 @@ class TerminalManager { if (lastWidth === null || lastHeight === null) { lastWidth = width; lastHeight = height; - + return; }