Merge pull request #224 from sourcelair/Tyriar-patch-2

Sync scroll bar height if the viewport height changes
This commit is contained in:
Daniel Imms
2016-08-09 09:03:16 -07:00
committed by GitHub
+7
View File
@@ -375,14 +375,19 @@
*/ */
Viewport.prototype.syncScrollArea = function() { Viewport.prototype.syncScrollArea = function() {
if (this.isApplicationMode) { if (this.isApplicationMode) {
// Fix scroll bar in application mode
this.lastRecordedBufferLength = this.terminal.rows; this.lastRecordedBufferLength = this.terminal.rows;
this.refresh(); this.refresh();
return; return;
} }
if (this.lastRecordedBufferLength !== this.terminal.lines.length) { if (this.lastRecordedBufferLength !== this.terminal.lines.length) {
// If buffer height changed
this.lastRecordedBufferLength = this.terminal.lines.length; this.lastRecordedBufferLength = this.terminal.lines.length;
this.refresh(); this.refresh();
} else if (this.lastRecordedViewportHeight !== this.terminal.rows) {
// If viewport height changed
this.refresh();
} else { } else {
// If size has changed, refresh viewport // If size has changed, refresh viewport
var size = this.charMeasureElement.getBoundingClientRect(); var size = this.charMeasureElement.getBoundingClientRect();
@@ -390,6 +395,8 @@
this.refresh(size); this.refresh(size);
} }
} }
// Sync scrollTop
var scrollTop = this.terminal.ydisp * this.currentRowHeight; var scrollTop = this.terminal.ydisp * this.currentRowHeight;
if (this.viewportElement.scrollTop !== scrollTop) { if (this.viewportElement.scrollTop !== scrollTop) {
this.viewportElement.scrollTop = scrollTop; this.viewportElement.scrollTop = scrollTop;