From 85c892c218c5529efd01569b7dc9b1123ae53582 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 6 Jul 2017 21:16:20 -0700 Subject: [PATCH] Don't refresh terminal when scrollDisp doesn't scroll Fixes #765 --- src/xterm.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/xterm.js b/src/xterm.js index dc3b940b..ab9c5320 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -1237,12 +1237,12 @@ Terminal.prototype.scrollDisp = function(disp, suppressScrollEvent) { this.userScrolling = false; } - this.ydisp += disp; + const oldYdisp = this.ydisp; + this.ydisp = Math.max(Math.min(this.ydisp + disp, this.ybase), 0); - if (this.ydisp > this.ybase) { - this.ydisp = this.ybase; - } else if (this.ydisp < 0) { - this.ydisp = 0; + // No change occurred, don't trigger scroll/refresh + if (oldYdisp === this.ydisp) { + return; } if (!suppressScrollEvent) {