Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class TerminalFontMetrics extends Disposable {
const editorConfig = this._configurationService.getValue<IEditorOptions>('editor');

let fontFamily = this._terminalConfigurationService.config.fontFamily || editorConfig.fontFamily || EDITOR_FONT_DEFAULTS.fontFamily || 'monospace';
let fontSize = clampInt(this._terminalConfigurationService.config.fontSize, FontConstants.MinimumFontSize, FontConstants.MaximumFontSize, EDITOR_FONT_DEFAULTS.fontSize);
let fontSize = clampFloat(this._terminalConfigurationService.config.fontSize, FontConstants.MinimumFontSize, FontConstants.MaximumFontSize, EDITOR_FONT_DEFAULTS.fontSize);

// Work around bad font on Fedora/Ubuntu
if (!this._terminalConfigurationService.config.fontFamily) {
Expand All @@ -131,7 +131,7 @@ export class TerminalFontMetrics extends Disposable {
fontFamily = '\'Ubuntu Mono\'';

// Ubuntu mono is somehow smaller, so set fontSize a bit larger to get the same perceived size.
fontSize = clampInt(fontSize + 2, FontConstants.MinimumFontSize, FontConstants.MaximumFontSize, EDITOR_FONT_DEFAULTS.fontSize);
fontSize = clampFloat(fontSize + 2, FontConstants.MinimumFontSize, FontConstants.MaximumFontSize, EDITOR_FONT_DEFAULTS.fontSize);
}
}

Expand Down Expand Up @@ -256,4 +256,15 @@ function clampInt<T>(source: string | number, minimum: number, maximum: number,
}
return clamp(r, minimum, maximum);
}

function clampFloat<T>(source: string | number, minimum: number, maximum: number, fallback: T): number | T {
if (source === null || source === undefined) {
return fallback;
}
const r = isString(source) ? parseFloat(source) : source;
if (isNaN(r)) {
return fallback;
}
return clamp(r, minimum, maximum);
}
// #endregion Utils
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,53 @@ suite('Workbench - TerminalConfigurationService', () => {
strictEqual(terminalConfigurationService.getFont(getActiveWindow()).fontSize, EDITOR_FONT_DEFAULTS.fontSize, 'The default editor font size should be used when terminal.integrated.fontSize is not set');
});

test('fontSize 11.5 (decimal)', () => {
const terminalConfigurationService = createTerminalConfigationService({
editor: {
fontFamily: 'foo',
fontSize: 9
},
terminal: {
integrated: {
fontFamily: 'bar',
fontSize: 11.5
}
}
});
strictEqual(terminalConfigurationService.getFont(getActiveWindow()).fontSize, 11.5, 'terminal.integrated.fontSize should preserve decimal values');
});

test('fontSize 13.25 (decimal)', () => {
const terminalConfigurationService = createTerminalConfigationService({
editor: {
fontFamily: 'foo',
fontSize: 9
},
terminal: {
integrated: {
fontFamily: 'bar',
fontSize: 13.25
}
}
});
strictEqual(terminalConfigurationService.getFont(getActiveWindow()).fontSize, 13.25, 'terminal.integrated.fontSize should preserve decimal values like 13.25');
});
Comment on lines +189 to +219
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test names should be more consistent with the existing pattern in the test suite. Tests like 'fontSize 10' don't include clarifying suffixes. Consider removing '(decimal)' from the first two test names since the value itself clearly indicates it's a decimal, leaving just 'fontSize 11.5' and 'fontSize 13.25' to match the existing convention.

Copilot uses AI. Check for mistakes.

test('fontSize decimal (Linux Ubuntu)', () => {
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test name 'fontSize decimal (Linux Ubuntu)' doesn't follow the established pattern of other tests. It should specify the actual font size value like 'fontSize 10.5 (Linux Ubuntu)' to match the convention used in tests like 'fontSize 0' and 'fontFamily (Linux Ubuntu)'.

Suggested change
test('fontSize decimal (Linux Ubuntu)', () => {
test('fontSize 10.5 (Linux Ubuntu)', () => {

Copilot uses AI. Check for mistakes.
const terminalConfigurationService = createTerminalConfigationService({
editor: {
fontFamily: 'foo'
},
terminal: {
integrated: {
fontFamily: null,
fontSize: 10.5
}
}
}, LinuxDistro.Ubuntu);
strictEqual(terminalConfigurationService.getFont(getActiveWindow()).fontSize, 12.5, 'Ubuntu font size adjustment should preserve decimal values (10.5 + 2 = 12.5)');
});
Comment on lines +189 to +234
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These three test cases test essentially the same behavior with slightly different decimal values. Consider consolidating the first two tests (11.5 and 13.25) into a single test that validates decimal preservation with one representative value, keeping only the Ubuntu-specific test separate as it tests the adjustment logic. This would reduce redundancy while maintaining adequate coverage.

Copilot uses AI. Check for mistakes.

test('lineHeight 2', () => {
const terminalConfigurationService = createTerminalConfigationService({
editor: {
Expand Down