Skip to content

Commit

Permalink
Merge pull request #224 from sourcelair/Tyriar-patch-2
Browse files Browse the repository at this point in the history
Sync scroll bar height if the viewport height changes
  • Loading branch information
Tyriar authored Aug 9, 2016
2 parents e7c7160 + 12923a6 commit b32a34b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/xterm.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,21 +375,28 @@
*/
Viewport.prototype.syncScrollArea = function() {
if (this.isApplicationMode) {
// Fix scroll bar in application mode
this.lastRecordedBufferLength = this.terminal.rows;
this.refresh();
return;
}

if (this.lastRecordedBufferLength !== this.terminal.lines.length) {
// If buffer height changed
this.lastRecordedBufferLength = this.terminal.lines.length;
this.refresh();
} else if (this.lastRecordedViewportHeight !== this.terminal.rows) {
// If viewport height changed
this.refresh();
} else {
// If size has changed, refresh viewport
var size = this.charMeasureElement.getBoundingClientRect();
if (size.height !== this.currentRowHeight) {
this.refresh(size);
}
}

// Sync scrollTop
var scrollTop = this.terminal.ydisp * this.currentRowHeight;
if (this.viewportElement.scrollTop !== scrollTop) {
this.viewportElement.scrollTop = scrollTop;
Expand Down

0 comments on commit b32a34b

Please sign in to comment.