From 61953f608e9089caab0c0dc60587689c439c6d59 Mon Sep 17 00:00:00 2001 From: cpsdqs Date: Sat, 30 Sep 2017 13:01:51 +0200 Subject: [PATCH] Surreptitiously add 24-color support --- js/term/screen_parser.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/js/term/screen_parser.js b/js/term/screen_parser.js index 73b8feb..b767df5 100644 --- a/js/term/screen_parser.js +++ b/js/term/screen_parser.js @@ -306,13 +306,13 @@ module.exports = class ScreenParser { break case SEQ_SET_COLORS: - data = strArray[ci++].codePointAt(0) - 1 + data = du(strArray[ci++]) fg = data & 0xFF bg = (data >> 8) & 0xFF break case SEQ_SET_ATTRS: - data = strArray[ci++].codePointAt(0) - 1 + data = du(strArray[ci++]) attrs = data & 0xFFFF break @@ -321,13 +321,23 @@ module.exports = class ScreenParser { break case SEQ_SET_FG: - data = strArray[ci++].codePointAt(0) - 1 - fg = data & 0xFF + data = du(strArray[ci++]) + if (data & 0x10000) { + data ^= 0x10000 + data |= du(strArray[ci++]) << 12 + data += 256 + } + fg = data break case SEQ_SET_BG: - data = strArray[ci++].codePointAt(0) - 1 - bg = data & 0xFF + data = du(strArray[ci++]) + if (data & 0x10000) { + data ^= 0x10000 + data |= du(strArray[ci++]) << 12 + data += 256 + } + bg = data break default: