mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Fix CharMeasure getting taller on successive calls
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user