]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Fix scroll in tmux with max scrollback
authorDaniel Imms <daimms@microsoft.com>
Sat, 31 Dec 2016 15:05:06 +0000 (07:05 -0800)
committerDaniel Imms <daimms@microsoft.com>
Sat, 31 Dec 2016 15:18:50 +0000 (07:18 -0800)
I believe this is related to when scrollBottom is not the last row in the viewport

Fixes #434

src/xterm.js

index 1d2206529efba38c3f7f4e767759a2ee8f3cfa29..6fddd111e7722908818576d85820a4b215b7c8ff 100644 (file)
@@ -1234,6 +1234,15 @@ Terminal.prototype.showCursor = function() {
 Terminal.prototype.scroll = function() {
   var row;
 
+  // Make room for the new row in lines
+  if (this.lines.length === this.lines.maxLength) {
+    this.lines.trimStart(1);
+    this.ybase--;
+    if (this.ydisp !== 0) {
+      this.ydisp--;
+    }
+  }
+
   this.ybase++;
 
   // TODO: Why is this done twice?
@@ -1248,13 +1257,6 @@ Terminal.prototype.scroll = function() {
   row -= this.rows - 1 - this.scrollBottom;
 
   if (row === this.lines.length) {
-    // Compensate ybase and ydisp if lines has hit the maximum buffer size
-    if (this.lines.length === this.lines.maxLength) {
-      this.ybase--;
-      if (this.ydisp !== 0) {
-        this.ydisp--;
-      }
-    }
     // Optimization: pushing is faster than splicing when they amount to the same behavior
     this.lines.push(this.blankLine());
   } else {