diff --git a/editor.html b/editor.html index 51da164..fe24d32 100644 --- a/editor.html +++ b/editor.html @@ -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(); } });