Implement partial screen updates

box-drawing
cpsdqs 7 years ago
parent dbd90cf166
commit 1bd6d3ae27
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 28
      js/term/screen_parser.js

@ -237,12 +237,12 @@ module.exports = class ScreenParser {
// TODO do something with those // TODO do something with those
} else if (topic === TOPIC_CONTENT) { } else if (topic === TOPIC_CONTENT) {
// set screen content
const window_y = du(strArray[ci++]) const frameY = du(strArray[ci++])
const window_x = du(strArray[ci++]) const frameX = du(strArray[ci++])
const window_h = du(strArray[ci++]) const frameHeight = du(strArray[ci++]) // FIXME unused, useless data!
const window_w = du(strArray[ci++]) const frameWidth = du(strArray[ci++])
// TODO use
// content // content
let fg = 7 let fg = 7
@ -264,7 +264,7 @@ module.exports = class ScreenParser {
const MASK_LINE_ATTR = ATTR_UNDERLINE | ATTR_OVERLINE | ATTR_STRIKE const MASK_LINE_ATTR = ATTR_UNDERLINE | ATTR_OVERLINE | ATTR_STRIKE
const MASK_BLINK = ATTR_BLINK const MASK_BLINK = ATTR_BLINK
let setCellContent = () => { let pushCell = () => {
// Remove blink attribute if it wouldn't have any effect // Remove blink attribute if it wouldn't have any effect
let myAttrs = attrs let myAttrs = attrs
let hasFG = attrs & ATTR_FG let hasFG = attrs & ATTR_FG
@ -282,10 +282,14 @@ module.exports = class ScreenParser {
else this.screen.blinkingCellCount-- else this.screen.blinkingCellCount--
} }
this.screen.screen[cell] = lastChar let cellXInFrame = cell % frameWidth
this.screen.screenFG[cell] = fg let cellYInFrame = Math.floor(cell / frameWidth)
this.screen.screenBG[cell] = bg let index = (frameY + cellYInFrame) * this.screen.window.width + frameX + cellXInFrame
this.screen.screenAttrs[cell] = myAttrs
this.screen.screen[index] = lastChar
this.screen.screenFG[index] = fg
this.screen.screenBG[index] = bg
this.screen.screenAttrs[index] = myAttrs
} }
while (ci < strArray.length && cell < screenLength) { while (ci < strArray.length && cell < screenLength) {
@ -297,7 +301,7 @@ module.exports = class ScreenParser {
case SEQ_REPEAT: case SEQ_REPEAT:
let count = strArray[ci++].codePointAt(0) - 1 let count = strArray[ci++].codePointAt(0) - 1
for (let j = 0; j < count; j++) { for (let j = 0; j < count; j++) {
setCellContent() pushCell()
if (++cell > screenLength) break if (++cell > screenLength) break
} }
break break
@ -326,7 +330,7 @@ module.exports = class ScreenParser {
default: default:
if (charCode < 32) character = '\ufffd' if (charCode < 32) character = '\ufffd'
lastChar = character lastChar = character
setCellContent() pushCell()
cell++ cell++
} }
} }

Loading…
Cancel
Save