@@ -94,22 +94,23 @@ export class DomRenderer extends EventEmitter implements IRenderer {
9494 }
9595
9696 private _updateDimensions ( ) : void {
97- this . dimensions . scaledCharWidth = this . _terminal . charMeasure . width * window . devicePixelRatio ;
98- this . dimensions . scaledCharHeight = this . _terminal . charMeasure . height * window . devicePixelRatio ;
99- this . dimensions . scaledCellWidth = this . dimensions . scaledCharWidth ;
100- this . dimensions . scaledCellHeight = this . dimensions . scaledCharHeight ;
97+ this . dimensions . scaledCharWidth = Math . floor ( this . _terminal . charMeasure . width * window . devicePixelRatio ) ;
98+ this . dimensions . scaledCharHeight = Math . ceil ( this . _terminal . charMeasure . height * window . devicePixelRatio ) ;
99+ this . dimensions . scaledCellWidth = this . dimensions . scaledCharWidth + Math . round ( this . _terminal . options . letterSpacing ) ;
100+ this . dimensions . scaledCellHeight = Math . floor ( this . dimensions . scaledCharHeight * this . _terminal . options . lineHeight ) ;
101101 this . dimensions . scaledCharLeft = 0 ;
102102 this . dimensions . scaledCharTop = 0 ;
103103 this . dimensions . scaledCanvasWidth = this . dimensions . scaledCellWidth * this . _terminal . cols ;
104104 this . dimensions . scaledCanvasHeight = this . dimensions . scaledCellHeight * this . _terminal . rows ;
105- this . dimensions . canvasWidth = this . _terminal . charMeasure . width * this . _terminal . cols ;
106- this . dimensions . canvasHeight = this . _terminal . charMeasure . height * this . _terminal . rows ;
107- this . dimensions . actualCellWidth = this . _terminal . charMeasure . width ;
108- this . dimensions . actualCellHeight = this . _terminal . charMeasure . height ;
105+ this . dimensions . canvasWidth = Math . round ( this . dimensions . scaledCanvasWidth / window . devicePixelRatio ) ;
106+ this . dimensions . canvasHeight = Math . round ( this . dimensions . scaledCanvasHeight / window . devicePixelRatio ) ;
107+ this . dimensions . actualCellWidth = this . dimensions . canvasWidth / this . _terminal . cols ;
108+ this . dimensions . actualCellHeight = this . dimensions . canvasHeight / this . _terminal . rows ;
109109
110110 this . _rowElements . forEach ( element => {
111111 element . style . width = `${ this . dimensions . canvasWidth } px` ;
112- element . style . height = `${ this . _terminal . charMeasure . height } px` ;
112+ element . style . height = `${ this . dimensions . actualCellHeight } px` ;
113+ element . style . lineHeight = `${ this . dimensions . actualCellHeight } px` ;
113114 } ) ;
114115
115116 if ( ! this . _dimensionsStyleElement ) {
@@ -290,10 +291,10 @@ export class DomRenderer extends EventEmitter implements IRenderer {
290291 */
291292 private _createSelectionElement ( row : number , colStart : number , colEnd : number , rowCount : number = 1 ) : HTMLElement {
292293 const element = document . createElement ( 'div' ) ;
293- element . style . height = `${ rowCount * this . _terminal . charMeasure . height } px` ;
294- element . style . top = `${ row * this . _terminal . charMeasure . height } px` ;
295- element . style . left = `${ colStart * this . _terminal . charMeasure . width } px` ;
296- element . style . width = `${ this . _terminal . charMeasure . width * ( colEnd - colStart ) } px` ;
294+ element . style . height = `${ rowCount * this . dimensions . actualCellHeight } px` ;
295+ element . style . top = `${ row * this . dimensions . actualCellHeight } px` ;
296+ element . style . left = `${ colStart * this . dimensions . actualCellWidth } px` ;
297+ element . style . width = `${ this . dimensions . actualCellWidth * ( colEnd - colStart ) } px` ;
297298 return element ;
298299 }
299300
0 commit comments