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 const self = this
this.window = new Proxy(this._window, { this.window = new Proxy(this._window, {
set (target, key, value, receiver) { set (target, key, value, receiver) {
target[key] = value if (target[key] !== value) {
self.scheduleSizeUpdate() target[key] = value
self.renderer.scheduleDraw(`window:${key}=${value}`) self.scheduleSizeUpdate()
self.emit(`update-window:${key}`, value) self.renderer.scheduleDraw(`window:${key}=${value}`)
self.emit(`update-window:${key}`, value)
}
return true return true
} }
}) })

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

Loading…
Cancel
Save