fix: use double requestAnimationFrame to ensure terminal dimensions are stable before fitting

This commit is contained in:
2026-03-21 21:21:42 +08:00
parent e1017164e8
commit 7e429c01c9

View File

@@ -231,7 +231,15 @@
term.loadAddon(fitAddon);
term.open(terminalContainer);
fitAddon.fit();
requestAnimationFrame(() => {
requestAnimationFrame(() => {
fitAddon.fit();
if (ws && ws.readyState === WebSocket.OPEN) {
ws.send(`\x1b[8;${term.rows};${term.cols}t`);
}
term.focus();
});
});
ws.binaryType = 'arraybuffer';