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. 2
      js/term/screen.js
  2. 9
      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) {
if (target[key] !== value) {
target[key] = value target[key] = value
self.scheduleSizeUpdate() self.scheduleSizeUpdate()
self.renderer.scheduleDraw(`window:${key}=${value}`) self.renderer.scheduleDraw(`window:${key}=${value}`)
self.emit(`update-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) {
if (fg !== this.defaultFgNum || bg !== this.defaultBgNum) {
this.resetDrawn()
this.defaultFgNum = fg this.defaultFgNum = fg
this.defaultBgNum = bg this.defaultBgNum = bg
this.resetDrawn() this.scheduleDraw('default-colors')
this.scheduleDraw('defaultColors') }
} }
/** /**

Loading…
Cancel
Save