Fix CharMeasure getting taller on successive calls

This commit is contained in:
Daniel Imms
2017-09-02 19:04:07 -07:00
parent 7ccac09b6b
commit c94e87428d
2 changed files with 6 additions and 5 deletions
-1
View File
@@ -56,7 +56,6 @@ export class Viewport implements IViewport {
if (rowHeightChanged) {
this.currentRowHeight = lineHeight;
this.viewportElement.style.lineHeight = lineHeight + 'px';
this.terminal.element.style.lineHeight = lineHeight + 'px';
}
const viewportHeightChanged = this.lastRecordedViewportHeight !== this.terminal.rows;
if (rowHeightChanged || viewportHeightChanged) {
+6 -4
View File
@@ -44,8 +44,8 @@
var availableHeight = parentElementHeight - elementPaddingVer;
var availableWidth = parentElementWidth - elementPaddingHor;
var geometry = {
cols: parseInt(availableWidth / term.charMeasure.width, 10),
rows: parseInt(availableHeight / (term.charMeasure.height * term.getOption('lineHeight')), 10)
cols: Math.floor(availableWidth / term.charMeasure.width),
rows: Math.floor(availableHeight / Math.ceil(term.charMeasure.height * term.getOption('lineHeight')))
};
return geometry;
@@ -59,8 +59,10 @@
if (geometry) {
// Force a full render
term.renderer.clear();
term.resize(geometry.cols, geometry.rows);
if (term.rows !== geometry.rows || term.cols !== geometry.cols) {
term.renderer.clear();
term.resize(geometry.cols, geometry.rows);
}
}
}, 0);
};