Also replace DEL with its graphical equivalent

This commit is contained in:
Juhani Krekelä 2018-06-25 23:11:08 +03:00
parent 91849e2d6a
commit e5138ff737
1 changed files with 3 additions and 0 deletions

View File

@ -65,11 +65,14 @@ function ircbotRun(program, input, maxCycles = 400000) {
// Replace all characters < 0x20 except for IRC formatting codes
// with their graphical representations at U+24xx
// Also replace DEL with U+2421
let formattingChars = [0x02, 0x03, 0x0f, 0x12, 0x15];
output = Array.from(output).map(c => {
let codePoint = c.codePointAt(0);
if(codePoint < 0x20 && !formattingChars.includes(codePoint)) {
return String.fromCodePoint(0x2400 + codePoint);
} else if(codePoint == 0x7f) {
return String.fromCodePoint(0x2421);
} else {
return c;
}