Fix inconsistency with lineHeight

This commit is contained in:
Daniel Imms
2017-09-03 09:05:26 -07:00
parent 48b37453ea
commit 2d1a1bfb76
2 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -57,7 +57,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
public resize(terminal: ITerminal, canvasWidth: number, canvasHeight: number, charSizeChanged: boolean): void {
this.scaledCharWidth = terminal.charMeasure.width * window.devicePixelRatio;
this.scaledCharHeight = terminal.charMeasure.height * window.devicePixelRatio;
this.scaledLineHeight = Math.ceil(this.scaledCharHeight * terminal.options.lineHeight);
this.scaledLineHeight = Math.floor(this.scaledCharHeight * terminal.options.lineHeight);
this.scaledLineDrawY = terminal.options.lineHeight === 1 ? 0 : Math.round((this.scaledLineHeight - this.scaledCharHeight) / 2);
this._canvas.width = canvasWidth * window.devicePixelRatio;
this._canvas.height = canvasHeight * window.devicePixelRatio;
@@ -143,7 +143,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
}
}
const isAscii = code < 256;
const isBasicColor = (colorIndex > 0 && fg < 16);
const isBasicColor = (colorIndex > 1 && fg < 16);
const isDefaultColor = fg >= 256;
if (isAscii && (isBasicColor || isDefaultColor)) {
// ImageBitmap's draw about twice as fast as from a canvas
+3
View File
@@ -47,6 +47,9 @@ export class Renderer {
}
public onResize(cols: number, rows: number): void {
if (!this._terminal.charMeasure.width || !this._terminal.charMeasure.height) {
return;
}
const width = this._terminal.charMeasure.width * this._terminal.cols;
const height = Math.floor(this._terminal.charMeasure.height * this._terminal.options.lineHeight) * this._terminal.rows;
this._renderLayers.forEach(l => l.resize(this._terminal, width, height, false));