提交 316d6f83 编写于 作者: P Phawin Khongkhasawan

Provide "terminal.integrated.enableBold" setting connected to #22422

上级 7ecdd35f
......@@ -50,7 +50,7 @@ DEFAULT_TERMINAL_LINUX_READY.then(defaultTerminalLinux => {
'description': nls.localize('terminal.external.linuxExec', "Customizes which terminal to run on Linux."),
'default': defaultTerminalLinux,
'isExecutable': true
}
},
}
});
});
......
......@@ -52,6 +52,7 @@ export interface ITerminalConfiguration {
fontFamily: string;
fontLigatures: boolean;
fontSize: number;
fontWeight: string;
lineHeight: number;
setLocaleVariables: boolean;
scrollback: number;
......@@ -71,6 +72,7 @@ export interface ITerminalFont {
lineHeight: number;
charWidth: number;
charHeight: number;
fontWeight: string;
}
export interface IShellLaunchConfig {
......
......@@ -106,6 +106,11 @@ configurationRegistry.registerConfiguration({
'type': 'number',
'default': 1.2
},
'terminal.integrated.fontWeight': {
'type': 'string',
'description': nls.localize('terminal.integrated.fontWeight', "Customizes font weight in terminal."),
'default': 'normal'
},
'terminal.integrated.cursorBlinking': {
'description': nls.localize('terminal.integrated.cursorBlinking', "Controls whether the terminal cursor blinks."),
'type': 'boolean',
......
......@@ -35,6 +35,10 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
return this._configurationService.getConfiguration<IFullTerminalConfiguration>().terminal.integrated;
}
public getTheme(baseThemeId: string): string[] {
return DEFAULT_ANSI_COLORS[baseThemeId];
}
private _measureFont(fontFamily: string, fontSize: number, lineHeight: number): ITerminalFont {
// Create charMeasureElement if it hasn't been created or if it was orphaned by its parent
if (!this._charMeasureElement || !this._charMeasureElement.parentElement) {
......@@ -79,12 +83,13 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
if (fontSize <= 0) {
fontSize = DefaultConfig.editor.fontSize;
}
let fontWeight = terminalConfig.fontWeight;
let lineHeight = terminalConfig.lineHeight <= 0 ? DEFAULT_LINE_HEIGHT : terminalConfig.lineHeight;
if (!lineHeight) {
lineHeight = DEFAULT_LINE_HEIGHT;
}
return this._measureFont(fontFamily, fontSize, lineHeight);
return this._measureFont(fontFamily, fontSize, lineHeight, fontWeight);
}
public mergeDefaultShellPathAndArgs(shell: IShellLaunchConfig): IShellLaunchConfig {
......
......@@ -235,6 +235,7 @@ export class TerminalPanel extends Panel {
`font-family: ${newFont.fontFamily};` +
`font-size: ${newFont.fontSize};` +
`line-height: ${newFont.lineHeight};` +
`font-weight: ${newFont.fontWeight};` +
'}';
this._font = newFont;
}
......
......@@ -117,6 +117,27 @@ suite('Workbench - TerminalConfigHelper', () => {
assert.equal(configHelper.getFont().fontSize, `${DefaultConfig.editor.fontSize}px`, 'The default editor font size should be used when editor.fontSize is < 0 and terminal.integrated.fontSize not set');
});
test('TerminalConfigHelper - getFont fontWeight', function () {
let configurationService: IConfigurationService;
let configHelper: TerminalConfigHelper;
configurationService = new MockConfigurationService({
editor: {
fontFamily: 'foo',
fontWeight: 'normal'
},
terminal: {
integrated: {
fontFamily: 'bar',
fontWeight: 'bold'
}
}
});
configHelper = new TerminalConfigHelper(Platform.Linux, configurationService);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().fontWeight, 'bold', 'terminal.integrated.fontWeight should be selected over editor.fontWeight');
});
test('TerminalConfigHelper - getFont lineHeight', function () {
let configurationService: IConfigurationService;
let configHelper: TerminalConfigHelper;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册