aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-03-27 09:09:46 +0000
committerGitHub <noreply@github.com>2025-03-27 09:09:46 +0000
commit8b30adf60bf7a66318c83ba6c286f7710a79094d (patch)
treee1d936470de74202cbc9f7d2c925aa7594698873
parent729b6a4337556c901f7b2c418ade93f9d2162f5b (diff)
parent1b5e83bfb628eda5a39f836c7b3116ad0666f607 (diff)
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"
-rw-r--r--core/sys/wasm/js/odin.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/sys/wasm/js/odin.js b/core/sys/wasm/js/odin.js
index b3a49523b..d5faa5210 100644
--- a/core/sys/wasm/js/odin.js
+++ b/core/sys/wasm/js/odin.js
@@ -1325,18 +1325,20 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
} else if (!line.includes("\n")) {
currentLine[isError] = currentLine[isError].concat(line);
} else {
- let lines = line.split("\n");
+ let lines = line.trimEnd().split("\n");
let printLast = lines.length > 1 && line.endsWith("\n");
println(currentLine[isError].concat(lines[0]));
currentLine[isError] = "";
for (let i = 1; i < lines.length-1; i++) {
println(lines[i]);
}
- let last = lines[lines.length-1];
- if (printLast) {
- println(last);
- } else {
- currentLine[isError] = last;
+ if (lines.length > 1) {
+ let last = lines[lines.length-1];
+ if (printLast) {
+ println(last);
+ } else {
+ currentLine[isError] = last;
+ }
}
}