Sync scroll bar height if the viewport height changes

This commit is contained in:
Daniel Imms
2016-08-08 14:41:39 -07:00
committed by GitHub
parent e7c7160f85
commit 12923a6649
+7
View File
@@ -375,14 +375,19 @@
*/
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();
@@ -390,6 +395,8 @@
this.refresh(size);
}
}
// Sync scrollTop
var scrollTop = this.terminal.ydisp * this.currentRowHeight;
if (this.viewportElement.scrollTop !== scrollTop) {
this.viewportElement.scrollTop = scrollTop;