Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/components/terminal/terminalManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,15 +668,31 @@ class TerminalManager {
const RESIZE_DEBOUNCE = 200;
let lastResizeTime = 0;

let lastWidth = 0;
let lastHeight = 0;
let lastWidth = null;
let lastHeight = null;

const handleResize = (entries) => {
const now = Date.now();
const entry = entries && entries[0];
const cr = entry?.contentRect;
const width = cr?.width ?? terminalFile.content?.clientWidth ?? 0;
const height = cr?.height ?? terminalFile.content?.clientHeight ?? 0;

// Skip resize events when container is hidden (via any method: inline style, CSS class, etc.)
const isHidden =
getComputedStyle(terminalFile.content).display === "none" ||
terminalFile.content?.offsetHeight === 0;
if (isHidden) {
return;
}
Comment thread
RohitKushvaha01 marked this conversation as resolved.

if (lastWidth === null || lastHeight === null) {
lastWidth = width;
lastHeight = height;

return;
}

// Clear any pending resize
if (resizeTimeout) {
clearTimeout(resizeTimeout);
Expand Down