|
@@ -191,7 +191,7 @@ export class DOMConsole {
|
|
}
|
|
}
|
|
|
|
|
|
async _appendText (text, type, newLine = false) {
|
|
async _appendText (text, type, newLine = false) {
|
|
- console.debug("Caling appendText");
|
|
|
|
|
|
+ // console.debug("Caling appendText");
|
|
const write_time = Date.now();
|
|
const write_time = Date.now();
|
|
this.pending_writes.push(0);
|
|
this.pending_writes.push(0);
|
|
await Utils.sleep(5);
|
|
await Utils.sleep(5);
|
|
@@ -209,7 +209,7 @@ export class DOMConsole {
|
|
}
|
|
}
|
|
this.currentLine.innerHTML += this.getOutputText(text);
|
|
this.currentLine.innerHTML += this.getOutputText(text);
|
|
if (newLine) {
|
|
if (newLine) {
|
|
- console.debug("append newline");
|
|
|
|
|
|
+ // console.debug("append newline");
|
|
this.currentLine = null;
|
|
this.currentLine = null;
|
|
}
|
|
}
|
|
this.scrollTerm();
|
|
this.scrollTerm();
|
|
@@ -228,6 +228,9 @@ export class DOMConsole {
|
|
textDiv.classList.add(divClass);
|
|
textDiv.classList.add(divClass);
|
|
if (filter) textDiv.innerHTML = this.getOutputText(text);
|
|
if (filter) textDiv.innerHTML = this.getOutputText(text);
|
|
else textDiv.innerHTML = `<span>${text}</span>`;
|
|
else textDiv.innerHTML = `<span>${text}</span>`;
|
|
|
|
+ if (this.currentLine != null && this.currentLine.innerHTML.length === 0) {
|
|
|
|
+ this.termDiv.removeChild(this.currentLine);
|
|
|
|
+ }
|
|
this.termDiv.insertBefore(textDiv, this.inputDiv);
|
|
this.termDiv.insertBefore(textDiv, this.inputDiv);
|
|
this.currentLine = null;
|
|
this.currentLine = null;
|
|
this.scrollTerm();
|
|
this.scrollTerm();
|
|
@@ -365,22 +368,21 @@ export class DOMConsole {
|
|
}
|
|
}
|
|
|
|
|
|
sendOutput (text) {
|
|
sendOutput (text) {
|
|
- // console.debug(text);
|
|
|
|
|
|
+ //console.debug(text);
|
|
let output = "" + text;
|
|
let output = "" + text;
|
|
if (output.indexOf("\n") !== -1) {
|
|
if (output.indexOf("\n") !== -1) {
|
|
- // console.debug("newline");
|
|
|
|
|
|
+ //console.debug("newline");
|
|
const outputList = output.split("\n");
|
|
const outputList = output.split("\n");
|
|
let i = 0;
|
|
let i = 0;
|
|
for (; i < outputList.length - 1; i += 1) {
|
|
for (; i < outputList.length - 1; i += 1) {
|
|
- // console.debug("newline write");
|
|
|
|
|
|
+ //console.debug("newline write");
|
|
let t = outputList[i];
|
|
let t = outputList[i];
|
|
t = t.replace(/\t/g, "  ");
|
|
t = t.replace(/\t/g, "  ");
|
|
t = t.replace(/\s/g, " ");
|
|
t = t.replace(/\s/g, " ");
|
|
- if (t.length == 0) {
|
|
|
|
- // t = " ";
|
|
|
|
- // console.debug('Empty string');
|
|
|
|
- this.currentLine = null;
|
|
|
|
- } else this.write(t, true);
|
|
|
|
|
|
+ if (t.length !== 0) {
|
|
|
|
+ this.write(t);
|
|
|
|
+ }
|
|
|
|
+ this.write("", true);
|
|
}
|
|
}
|
|
let t = outputList[i];
|
|
let t = outputList[i];
|
|
t = t.replace(/\t/g, "  ");
|
|
t = t.replace(/\t/g, "  ");
|
|
@@ -390,7 +392,7 @@ export class DOMConsole {
|
|
// console.debug("no newline");
|
|
// console.debug("no newline");
|
|
output = output.replace(/\t/g, "  ");
|
|
output = output.replace(/\t/g, "  ");
|
|
output = output.replace(/\s/g, " ");
|
|
output = output.replace(/\s/g, " ");
|
|
- this.write(output);
|
|
|
|
|
|
+ if (output.length != 0) this.write(output);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|