Fixed console scrolling on the editor
This commit is contained in:
17
editor.html
17
editor.html
@@ -208,18 +208,23 @@
|
|||||||
|
|
||||||
let StopExecution;
|
let StopExecution;
|
||||||
let term;
|
let term;
|
||||||
|
let fitAddon;
|
||||||
let inputResolve;
|
let inputResolve;
|
||||||
let inputBuffer = '';
|
|
||||||
let acceptingInput = false;
|
|
||||||
|
|
||||||
term = new Terminal({
|
term = new Terminal({
|
||||||
cursorBlink: true,
|
cursorBlink: true,
|
||||||
theme: {
|
theme: {
|
||||||
background: '#1e1e1e'
|
background: '#1e1e1e'
|
||||||
}
|
},
|
||||||
|
scrollback: 10000,
|
||||||
|
allowProposedApi: true
|
||||||
});
|
});
|
||||||
|
fitAddon = new FitAddon.FitAddon();
|
||||||
|
term.loadAddon(fitAddon);
|
||||||
term.open(document.getElementById('terminal'));
|
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) {
|
function outf(text) {
|
||||||
term.write(text.replace(/\n/g, '\r\n'));
|
term.write(text.replace(/\n/g, '\r\n'));
|
||||||
@@ -339,8 +344,8 @@
|
|||||||
canvas.width = container.clientWidth;
|
canvas.width = container.clientWidth;
|
||||||
canvas.height = container.clientHeight;
|
canvas.height = container.clientHeight;
|
||||||
}
|
}
|
||||||
if (term) {
|
if (fitAddon) {
|
||||||
term.fit();
|
fitAddon.fit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user