Add blinking cell counter back

pull/1/head
cpsdqs 7 years ago
parent 90a1676084
commit 174e6950d0
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 8
      js/term/screen.js
  2. 14
      js/term/screen_parser.js

@ -4,6 +4,7 @@ const { mk, qs } = require('../utils')
const notify = require('../notif') const notify = require('../notif')
const ScreenParser = require('./screen_parser') const ScreenParser = require('./screen_parser')
const ScreenRenderer = require('./screen_renderer') const ScreenRenderer = require('./screen_renderer')
const { ATTR_BLINK } = require('./screen_attr_bits')
module.exports = class TermScreen extends EventEmitter { module.exports = class TermScreen extends EventEmitter {
constructor () { constructor () {
@ -714,12 +715,19 @@ module.exports = class TermScreen extends EventEmitter {
let cellYInFrame = Math.floor(cell / frameWidth) let cellYInFrame = Math.floor(cell / frameWidth)
let index = (frameY + cellYInFrame) * this.window.width + frameX + cellXInFrame 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.screen[index] = data[0]
this.screenFG[index] = data[1] this.screenFG[index] = data[1]
this.screenBG[index] = data[2] this.screenBG[index] = data[2]
this.screenAttrs[index] = data[3] this.screenAttrs[index] = data[3]
} }
if (this.window.debug) console.log(`Blinking cells: ${this.blinkingCellCount}`)
this.renderer.scheduleDraw('load', 16) this.renderer.scheduleDraw('load', 16)
this.conn.emit('load') this.conn.emit('load')
this.emit('load') this.emit('load')

@ -69,13 +69,13 @@ module.exports = class ScreenParser {
parseUpdate (str) { parseUpdate (str) {
// console.log(`update ${str}`) // console.log(`update ${str}`)
// current index // current index
let ci = 0 let ci = 0
let strArray = Array.from ? Array.from(str) : str.split('') let strArray = Array.from ? Array.from(str) : str.split('')
let text let text
const topics = du(strArray[ci++]) const topics = du(strArray[ci++])
// this.screen.cursor.hanging = !!(attributes & (1 << 1))
let collectOneTerminatedString = () => { let collectOneTerminatedString = () => {
// TODO optimize this // TODO optimize this
@ -256,15 +256,6 @@ module.exports = class ScreenParser {
cellAttrs ^= MASK_BLINK 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 // 8 dark system colors turn bright when bold
if ((cellAttrs & ATTR_BOLD) && !(cellAttrs & ATTR_FAINT) && hasFG && cellFG < 8) { if ((cellAttrs & ATTR_BOLD) && !(cellAttrs & ATTR_FAINT) && hasFG && cellFG < 8) {
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({ updates.push({
topic: 'content', topic: 'content',
frameX, frameX,

Loading…
Cancel
Save