Skip to content

Commit

Permalink
Fix scroll in tmux with max scrollback
Browse files Browse the repository at this point in the history
I believe this is related to when scrollBottom is not the last row in the viewport

Fixes xtermjs#434
  • Loading branch information
Tyriar committed Dec 31, 2016
1 parent 23472e6 commit c3f46e4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/xterm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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 {
Expand Down

0 comments on commit c3f46e4

Please sign in to comment.