Don't print control characters in terminal

This commit is contained in:
Fabian 2020-12-31 19:14:33 -06:00
parent 948fcc1c55
commit fe6872d55b
2 changed files with 3 additions and 2 deletions

View file

@ -323,7 +323,8 @@ UART.prototype.write_data = function(out_byte)
if(char === "\n")
{
dbg_log("SERIAL: " + String.fromCharCode.apply("", this.current_line).trimRight());
const line = String.fromCharCode.apply("", this.current_line).trimRight().replace(/[\x00-\x08\x0b-\x1f\x7f\x80-\xff]/g, "");
dbg_log("SERIAL: " + line);
this.bus.send("serial0-output-line", String.fromCharCode.apply("", this.current_line));
this.current_line = [];
}

View file

@ -42,7 +42,7 @@ emulator.add_listener("serial0-output-char", function(chr)
console.error("Serial: %s", line);
line = "";
}
else
else if(chr >= " " && chr <= "~")
{
line += chr;
}