mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
parent
1b412073b9
commit
236700ea58
|
@ -1,18 +1,20 @@
|
||||||
let $rt_stdoutBuffer = "";
|
let $rt_stdoutBuffer = "";
|
||||||
function $rt_putStdoutCustom(str) {
|
function $rt_putStdoutCustom(msg) {
|
||||||
let index = 0;
|
let index = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
let next = msg.indexOf('\n', index);
|
let next = msg.indexOf('\n', index);
|
||||||
if (next < 0) {
|
if (next < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let line = buffer + msg.substring(index, next);
|
let line = $rt_stdoutBuffer + msg.substring(index, next);
|
||||||
let lineElem = document.createElement("div");
|
let lineElem = document.createElement("div");
|
||||||
let stdoutElem = document.getElementById("stdout");
|
let stdoutElem = document.getElementById("stdout");
|
||||||
lineElem.appendChild(document.createTextNode(line));
|
lineElem.appendChild(document.createTextNode(line));
|
||||||
stdoutElem.appendChild(lineElem);
|
stdoutElem.appendChild(lineElem);
|
||||||
buffer = "";
|
stdoutElem.scrollTop = stdoutElem.scrollHeight;
|
||||||
|
$rt_stdoutBuffer = "";
|
||||||
index = next + 1;
|
index = next + 1;
|
||||||
}
|
}
|
||||||
|
$rt_stdoutBuffer += msg.substring(index);
|
||||||
}
|
}
|
||||||
this.$rt_putStdoutCustom = $rt_putStdoutCustom;
|
this.$rt_putStdoutCustom = $rt_putStdoutCustom;
|
Loading…
Reference in New Issue
Block a user