diff --git a/js/term/screen.js b/js/term/screen.js index 8cb0161..3fbd187 100644 --- a/js/term/screen.js +++ b/js/term/screen.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 } }) diff --git a/js/term/screen_renderer.js b/js/term/screen_renderer.js index ed361be..6980169 100644 --- a/js/term/screen_renderer.js +++ b/js/term/screen_renderer.js @@ -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') + } } /**