Fix inconsistency with lineHeight
This commit is contained in:
@@ -57,7 +57,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
public resize(terminal: ITerminal, canvasWidth: number, canvasHeight: number, charSizeChanged: boolean): void {
|
public resize(terminal: ITerminal, canvasWidth: number, canvasHeight: number, charSizeChanged: boolean): void {
|
||||||
this.scaledCharWidth = terminal.charMeasure.width * window.devicePixelRatio;
|
this.scaledCharWidth = terminal.charMeasure.width * window.devicePixelRatio;
|
||||||
this.scaledCharHeight = terminal.charMeasure.height * 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.scaledLineDrawY = terminal.options.lineHeight === 1 ? 0 : Math.round((this.scaledLineHeight - this.scaledCharHeight) / 2);
|
||||||
this._canvas.width = canvasWidth * window.devicePixelRatio;
|
this._canvas.width = canvasWidth * window.devicePixelRatio;
|
||||||
this._canvas.height = canvasHeight * window.devicePixelRatio;
|
this._canvas.height = canvasHeight * window.devicePixelRatio;
|
||||||
@@ -143,7 +143,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const isAscii = code < 256;
|
const isAscii = code < 256;
|
||||||
const isBasicColor = (colorIndex > 0 && fg < 16);
|
const isBasicColor = (colorIndex > 1 && fg < 16);
|
||||||
const isDefaultColor = fg >= 256;
|
const isDefaultColor = fg >= 256;
|
||||||
if (isAscii && (isBasicColor || isDefaultColor)) {
|
if (isAscii && (isBasicColor || isDefaultColor)) {
|
||||||
// ImageBitmap's draw about twice as fast as from a canvas
|
// ImageBitmap's draw about twice as fast as from a canvas
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ export class Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onResize(cols: number, rows: number): void {
|
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 width = this._terminal.charMeasure.width * this._terminal.cols;
|
||||||
const height = Math.floor(this._terminal.charMeasure.height * this._terminal.options.lineHeight) * this._terminal.rows;
|
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));
|
this._renderLayers.forEach(l => l.resize(this._terminal, width, height, false));
|
||||||
|
|||||||
Reference in New Issue
Block a user