Fix fit using correct dims on demo

This doesn't add the debounce suggested in the issue, but it does
comment about it.

Fixes #4114
This commit is contained in:
Daniel Imms
2025-12-29 04:58:12 -08:00
parent 8d532a35c4
commit 1d793c9054
2 changed files with 7 additions and 5 deletions
+6
View File
@@ -340,11 +340,17 @@ function createTerminal(): Terminal {
const resizeObserver = new ResizeObserver(entries => {
if (optionsWindow.autoResize) {
// In general this should be debounced to avoid excessive work on the main
// thread by firing the expensive resize action repeatedly
addons.fit.instance.fit();
}
});
resizeObserver.observe(terminalContainer);
window.addEventListener('resize', () => {
terminalContainer.style.width = document.body.clientWidth + 'px';
});
// fit is called within a setTimeout, cols and rows need this.
setTimeout(async () => {
optionsWindow.initOptions(addDomListener);