2023-01-03 06:29:13 -08:00
|
|
|
let $rt_stdoutBuffer = "";
|
2024-05-12 07:16:27 -07:00
|
|
|
function $rt_putStdoutCustom(msg) {
|
2023-11-07 11:00:33 -08:00
|
|
|
let index = 0;
|
|
|
|
while (true) {
|
|
|
|
let next = msg.indexOf('\n', index);
|
|
|
|
if (next < 0) {
|
|
|
|
break;
|
|
|
|
}
|
2024-05-12 07:16:27 -07:00
|
|
|
let line = $rt_stdoutBuffer + msg.substring(index, next);
|
2023-11-07 11:00:33 -08:00
|
|
|
let lineElem = document.createElement("div");
|
|
|
|
let stdoutElem = document.getElementById("stdout");
|
|
|
|
lineElem.appendChild(document.createTextNode(line));
|
2015-03-08 04:13:25 -07:00
|
|
|
stdoutElem.appendChild(lineElem);
|
2024-05-12 07:16:27 -07:00
|
|
|
stdoutElem.scrollTop = stdoutElem.scrollHeight;
|
|
|
|
$rt_stdoutBuffer = "";
|
2023-11-07 11:00:33 -08:00
|
|
|
index = next + 1;
|
2015-03-08 04:13:25 -07:00
|
|
|
}
|
2024-05-12 07:16:27 -07:00
|
|
|
$rt_stdoutBuffer += msg.substring(index);
|
2023-01-03 06:29:13 -08:00
|
|
|
}
|
|
|
|
this.$rt_putStdoutCustom = $rt_putStdoutCustom;
|