Skip to content

Commit

Permalink
Set terminal font details on xterm construction
Browse files Browse the repository at this point in the history
Fixes #34494
  • Loading branch information
Tyriar committed Sep 28, 2017
1 parent 5b76a1d commit 8b1909d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/vs/workbench/parts/terminal/common/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ export interface ITerminalFont {
fontFamily: string;
fontSize: number;
lineHeight: number;
charWidth: number;
charHeight: number;
charWidth?: number;
charHeight?: number;
}

export interface IShellLaunchConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
* Gets the font information based on the terminal.integrated.fontFamily
* terminal.integrated.fontSize, terminal.integrated.lineHeight configuration properties
*/
public getFont(): ITerminalFont {
public getFont(excludeDimensions?: boolean): ITerminalFont {
const config = this._configurationService.getConfiguration();
const editorConfig = (<IEditorConfiguration>config).editor;
const terminalConfig = this.config;
Expand All @@ -96,6 +96,14 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
}
const lineHeight = terminalConfig.lineHeight ? Math.max(terminalConfig.lineHeight, 1) : DEFAULT_LINE_HEIGHT;

if (excludeDimensions) {
return {
fontFamily,
fontSize,
lineHeight
};
}

return this._measureFont(fontFamily, fontSize, lineHeight);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,13 @@ export class TerminalInstance implements ITerminalInstance {
* Create xterm.js instance and attach data listeners.
*/
protected _createXterm(): void {
const font = this._configHelper.getFont(true);
this._xterm = new XTermTerminal({
scrollback: this._configHelper.config.scrollback,
theme: this._getXtermTheme()
theme: this._getXtermTheme(),
fontFamily: font.fontFamily,
fontSize: font.fontSize,
lineHeight: font.lineHeight
});
if (this._shellLaunchConfig.initialText) {
this._xterm.writeln(this._shellLaunchConfig.initialText);
Expand Down

0 comments on commit 8b1909d

Please sign in to comment.