Fixed console scrolling on the editor
This commit is contained in:
17
editor.html
17
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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user