diff --git a/browser-ui/wasm-terminal.js b/browser-ui/wasm-terminal.js index 220988c..d270613 100644 --- a/browser-ui/wasm-terminal.js +++ b/browser-ui/wasm-terminal.js @@ -91,8 +91,11 @@ export class WasmTerminal { this.xterm.clear(); } - print(message) { - const normInput = message.replace(/[\r\n]+/g, "\n").replace(/\n/g, "\r\n"); - this.xterm.write(normInput); + print(charCode) { + let array = [charCode]; + if (charCode == 10) { + array = [13, 10]; // Replace \n with \r\n + } + this.xterm.write(new Uint8Array(array)); } } diff --git a/browser-ui/worker/worker.js b/browser-ui/worker/worker.js index c3a8bdf..1b79460 100644 --- a/browser-ui/worker/worker.js +++ b/browser-ui/worker/worker.js @@ -35,15 +35,11 @@ class StdinBuffer { } } -const stdoutBufSize = 128; -const stdoutBuf = new Int32Array() -let index = 0; - const stdout = (charCode) => { if (charCode) { postMessage({ type: 'stdout', - stdout: String.fromCharCode(charCode), + stdout: charCode, }) } else { console.log(typeof charCode, charCode) @@ -54,7 +50,7 @@ const stderr = (charCode) => { if (charCode) { postMessage({ type: 'stderr', - stderr: String.fromCharCode(charCode), + stderr: charCode, }) } else { console.log(typeof charCode, charCode)