Prevent unnecessary full screen redraws

box-drawing
cpsdqs 7 years ago
parent 572dea2370
commit 4943abb354
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 10
      js/term/screen.js
  2. 13
      js/term/screen_renderer.js

@ -103,10 +103,12 @@ module.exports = class TermScreen extends EventEmitter {
const self = this
this.window = new Proxy(this._window, {
set (target, key, value, receiver) {
target[key] = value
self.scheduleSizeUpdate()
self.renderer.scheduleDraw(`window:${key}=${value}`)
self.emit(`update-window:${key}`, value)
if (target[key] !== value) {
target[key] = value
self.scheduleSizeUpdate()
self.renderer.scheduleDraw(`window:${key}=${value}`)
self.emit(`update-window:${key}`, value)
}
return true
}
})

@ -52,6 +52,9 @@ module.exports = class ScreenRenderer {
resetDrawn () {
// used to determine if a cell should be redrawn; storing the current state
// as it is on screen
if (this.screen.window && this.screen.window.debug) {
console.log('Resetting drawn screen')
}
this.drawnScreen = []
this.drawnScreenFG = []
this.drawnScreenBG = []
@ -81,10 +84,12 @@ module.exports = class ScreenRenderer {
}
setDefaultColors (fg, bg) {
this.defaultFgNum = fg
this.defaultBgNum = bg
this.resetDrawn()
this.scheduleDraw('defaultColors')
if (fg !== this.defaultFgNum || bg !== this.defaultBgNum) {
this.resetDrawn()
this.defaultFgNum = fg
this.defaultBgNum = bg
this.scheduleDraw('default-colors')
}
}
/**

Loading…
Cancel
Save