Fix: webapp console: Only add the date at the beginning if the last character was a newline
This commit is contained in:
parent
3504884836
commit
58214ccbea
@ -43,6 +43,7 @@ export default defineComponent({
|
|||||||
dataLoading: true,
|
dataLoading: true,
|
||||||
consoleBuffer: "",
|
consoleBuffer: "",
|
||||||
isAutoScroll: true,
|
isAutoScroll: true,
|
||||||
|
endWithNewline: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -78,10 +79,13 @@ export default defineComponent({
|
|||||||
console.log(event);
|
console.log(event);
|
||||||
|
|
||||||
let outstr = new String(event.data);
|
let outstr = new String(event.data);
|
||||||
|
let removedNewline = false;
|
||||||
if (outstr.endsWith('\n')) {
|
if (outstr.endsWith('\n')) {
|
||||||
outstr = outstr.substring(0, outstr.length - 1);
|
outstr = outstr.substring(0, outstr.length - 1);
|
||||||
|
removedNewline = true;
|
||||||
}
|
}
|
||||||
this.consoleBuffer += this.getOutDate() + outstr.replaceAll("\n", "\n" + this.getOutDate());
|
this.consoleBuffer += (this.endWithNewline ? this.getOutDate() : '') + outstr.replaceAll("\n", "\n" + this.getOutDate());
|
||||||
|
this.endWithNewline = removedNewline;
|
||||||
this.heartCheck(); // Reset heartbeat detection
|
this.heartCheck(); // Reset heartbeat detection
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user