Fix def fg bg color encoding. Protocol change!

box-drawing
Ondřej Hruška 7 years ago
parent 23fc105754
commit 46099bb749
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 14
      js/term/screen_parser.js

@ -86,12 +86,10 @@ module.exports = class ScreenParser {
const newHeight = du(strArray[ci++]) const newHeight = du(strArray[ci++])
const newWidth = du(strArray[ci++]) const newWidth = du(strArray[ci++])
const theme = du(strArray[ci++]) const theme = du(strArray[ci++])
const defFg = du(strArray[ci++]) | (du(strArray[ci++]) << 12) const defFg = (du(strArray[ci++]) & 0xFFFF) | ((du(strArray[ci++]) & 0xFFFF) << 16)
const defBg = du(strArray[ci++]) | (du(strArray[ci++]) << 12) const defBg = (du(strArray[ci++]) & 0xFFFF) | ((du(strArray[ci++]) & 0xFFFF) << 16)
const attributes = du(strArray[ci++]) const attributes = du(strArray[ci++])
console.log(`set colors ${defFg}, ${defBg}, theme ${theme}`)
// theming // theming
this.screen.renderer.loadTheme(theme) this.screen.renderer.loadTheme(theme)
this.screen.renderer.setDefaultColors(defFg, defBg) this.screen.renderer.setDefaultColors(defFg, defBg)
@ -323,8 +321,8 @@ module.exports = class ScreenParser {
case SEQ_SET_FG: case SEQ_SET_FG:
data = du(strArray[ci++]) data = du(strArray[ci++])
if (data & 0x10000) { if (data & 0x10000) {
data ^= 0x10000 data &= 0xFFF
data |= du(strArray[ci++]) << 12 data |= (du(strArray[ci++]) & 0xFFF) << 12
data += 256 data += 256
} }
fg = data fg = data
@ -333,8 +331,8 @@ module.exports = class ScreenParser {
case SEQ_SET_BG: case SEQ_SET_BG:
data = du(strArray[ci++]) data = du(strArray[ci++])
if (data & 0x10000) { if (data & 0x10000) {
data ^= 0x10000 data &= 0xFFF
data |= du(strArray[ci++]) << 12 data |= (du(strArray[ci++]) & 0xFFF) << 12
data += 256 data += 256
} }
bg = data bg = data

Loading…
Cancel
Save