Fixed console scrolling on the editor

This commit is contained in:
2025-12-25 17:40:39 +00:00
parent a12a47a069
commit 8ca6d8d0e1

View File

@@ -208,18 +208,23 @@
let StopExecution;
let term;
let fitAddon;
let inputResolve;
let inputBuffer = '';
let acceptingInput = false;
term = new Terminal({
cursorBlink: true,
theme: {
background: '#1e1e1e'
}
},
scrollback: 10000,
allowProposedApi: true
});
fitAddon = new FitAddon.FitAddon();
term.loadAddon(fitAddon);
term.open(document.getElementById('terminal'));
term.fit();
// Use a small timeout to ensure the DOM is ready before fitting
setTimeout(() => fitAddon.fit(), 0);
function outf(text) {
term.write(text.replace(/\n/g, '\r\n'));
@@ -339,8 +344,8 @@
canvas.width = container.clientWidth;
canvas.height = container.clientHeight;
}
if (term) {
term.fit();
if (fitAddon) {
fitAddon.fit();
}
});