From 174e6950d0d5bc0423639d7e74ee696b0e23a5a5 Mon Sep 17 00:00:00 2001 From: cpsdqs Date: Sun, 8 Oct 2017 13:59:01 +0200 Subject: [PATCH] Add blinking cell counter back --- js/term/screen.js | 8 ++++++++ js/term/screen_parser.js | 14 +------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/js/term/screen.js b/js/term/screen.js index e9f039c..08aa102 100644 --- a/js/term/screen.js +++ b/js/term/screen.js @@ -4,6 +4,7 @@ const { mk, qs } = require('../utils') const notify = require('../notif') const ScreenParser = require('./screen_parser') const ScreenRenderer = require('./screen_renderer') +const { ATTR_BLINK } = require('./screen_attr_bits') module.exports = class TermScreen extends EventEmitter { constructor () { @@ -714,12 +715,19 @@ module.exports = class TermScreen extends EventEmitter { let cellYInFrame = Math.floor(cell / frameWidth) let index = (frameY + cellYInFrame) * this.window.width + frameX + cellXInFrame + if (this.screenAttrs[index] & ATTR_BLINK !== data[3] & ATTR_BLINK) { + if (data[3] & ATTR_BLINK) this.blinkingCellCount++ + else this.blinkingCellCount-- + } + this.screen[index] = data[0] this.screenFG[index] = data[1] this.screenBG[index] = data[2] this.screenAttrs[index] = data[3] } + if (this.window.debug) console.log(`Blinking cells: ${this.blinkingCellCount}`) + this.renderer.scheduleDraw('load', 16) this.conn.emit('load') this.emit('load') diff --git a/js/term/screen_parser.js b/js/term/screen_parser.js index 090ea75..a80fbd9 100644 --- a/js/term/screen_parser.js +++ b/js/term/screen_parser.js @@ -69,13 +69,13 @@ module.exports = class ScreenParser { parseUpdate (str) { // console.log(`update ${str}`) + // current index let ci = 0 let strArray = Array.from ? Array.from(str) : str.split('') let text const topics = du(strArray[ci++]) - // this.screen.cursor.hanging = !!(attributes & (1 << 1)) let collectOneTerminatedString = () => { // TODO optimize this @@ -256,15 +256,6 @@ module.exports = class ScreenParser { cellAttrs ^= MASK_BLINK } - // TODO: reimplement - /* - // update blinking cells counter if blink state changed - if ((this.screen.screenAttrs[cell] & MASK_BLINK) !== (cellAttrs & MASK_BLINK)) { - if (cellAttrs & MASK_BLINK) this.screen.blinkingCellCount++ - else this.screen.blinkingCellCount-- - } - */ - // 8 dark system colors turn bright when bold if ((cellAttrs & ATTR_BOLD) && !(cellAttrs & ATTR_FAINT) && hasFG && cellFG < 8) { cellFG += 8 @@ -334,9 +325,6 @@ module.exports = class ScreenParser { } } - // TODO (see above) - // if (this.screen.window.debug) console.log(`Blinky cells: ${this.screen.blinkingCellCount}`) - updates.push({ topic: 'content', frameX,