Skip to content

Conversation

@ayush-that
Copy link

Fixes #286194

Problem

terminal.integrated.fontSize truncates decimal values. Setting 11.25 results in 11px, while editor.fontSize correctly preserves decimals.

Solution

Replaced parseInt() with parseFloat() in terminal font size processing by adding a clampFloat() helper function.

Testing

  • Added 3 unit tests for decimal font sizes
  • All existing tests pass
vscodeterm.mp4

Copilot AI review requested due to automatic review settings January 6, 2026 20:16
@ayush-that
Copy link
Author

@microsoft-github-policy-service agree

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes issue #286194 where terminal.integrated.fontSize truncates decimal values. The fix replaces parseInt() with parseFloat() for font size processing, making terminal font size behavior consistent with editor.fontSize.

Key Changes:

  • Added clampFloat() helper function to handle decimal font sizes
  • Updated font size processing to use clampFloat() instead of clampInt()
  • Added three unit tests verifying decimal font size preservation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/vs/workbench/contrib/terminal/browser/terminalConfigurationService.ts Added clampFloat() function and updated font size clamping calls to preserve decimal values
src/vs/workbench/contrib/terminal/test/browser/terminalConfigurationService.test.ts Added three tests verifying decimal font sizes work correctly, including Ubuntu-specific adjustment logic

strictEqual(terminalConfigurationService.getFont(getActiveWindow()).fontSize, 13.25, 'terminal.integrated.fontSize should preserve decimal values like 13.25');
});

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.
Comment on lines +189 to +234
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');
});

test('fontSize decimal (Linux Ubuntu)', () => {
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)');
});
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.
Comment on lines +189 to +219
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');
});
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.
@Tyriar Tyriar added this to the January 2026 milestone Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support decimal/floating-point values for terminal.integrated.fontSize

3 participants