mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Merge pull request #4973 from openhood/sys-wasm-prevent-empty-lines-in-console
Prevent odin.js from printing empty line in the console for the ending "\n"
This commit is contained in:
@@ -1325,13 +1325,14 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
|||||||
} else if (!line.includes("\n")) {
|
} else if (!line.includes("\n")) {
|
||||||
currentLine[isError] = currentLine[isError].concat(line);
|
currentLine[isError] = currentLine[isError].concat(line);
|
||||||
} else {
|
} else {
|
||||||
let lines = line.split("\n");
|
let lines = line.trimEnd().split("\n");
|
||||||
let printLast = lines.length > 1 && line.endsWith("\n");
|
let printLast = lines.length > 1 && line.endsWith("\n");
|
||||||
println(currentLine[isError].concat(lines[0]));
|
println(currentLine[isError].concat(lines[0]));
|
||||||
currentLine[isError] = "";
|
currentLine[isError] = "";
|
||||||
for (let i = 1; i < lines.length-1; i++) {
|
for (let i = 1; i < lines.length-1; i++) {
|
||||||
println(lines[i]);
|
println(lines[i]);
|
||||||
}
|
}
|
||||||
|
if (lines.length > 1) {
|
||||||
let last = lines[lines.length-1];
|
let last = lines[lines.length-1];
|
||||||
if (printLast) {
|
if (printLast) {
|
||||||
println(last);
|
println(last);
|
||||||
@@ -1339,6 +1340,7 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
|||||||
currentLine[isError] = last;
|
currentLine[isError] = last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (prevIsError != isError) {
|
if (prevIsError != isError) {
|
||||||
if (prevIsError) {
|
if (prevIsError) {
|
||||||
|
|||||||
Reference in New Issue
Block a user