Skip to content

Commit

Permalink
Correct term char width calculation under DOM renderer
Browse files Browse the repository at this point in the history
Fixes #51479
  • Loading branch information
Tyriar committed Jul 6, 2018
1 parent 54fd81d commit 9989abf
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@ export class TerminalInstance implements ITerminalInstance {
// order to be precise. font.charWidth/charHeight alone as insufficient
// when window.devicePixelRatio changes.
const scaledWidthAvailable = dimension.width * window.devicePixelRatio;
const scaledCharWidth = Math.floor(font.charWidth * window.devicePixelRatio) + font.letterSpacing;

let scaledCharWidth: number;
if (this._configHelper.config.rendererType === 'dom') {
scaledCharWidth = font.charWidth * window.devicePixelRatio;
} else {
scaledCharWidth = Math.floor(font.charWidth * window.devicePixelRatio) + font.letterSpacing;
}
this._cols = Math.max(Math.floor(scaledWidthAvailable / scaledCharWidth), 1);

const scaledHeightAvailable = dimension.height * window.devicePixelRatio;
Expand Down

0 comments on commit 9989abf

Please sign in to comment.