Merge pull request #3051 from pascalandr/fix/3046-editor-font-size-persistence

fix(settings): persist editor font size
This commit is contained in:
Bohdan Triapitsyn
2026-08-27 23:14:04 +03:00
committed by GitHub
2 changed files with 13 additions and 0 deletions
@@ -616,6 +616,9 @@ export const createSettingsHelpers = (dependencies) => {
if (typeof candidate.terminalFontSize === 'number' && Number.isFinite(candidate.terminalFontSize)) {
result.terminalFontSize = Math.max(9, Math.min(52, Math.round(candidate.terminalFontSize)));
}
if (typeof candidate.editorFontSize === 'number' && Number.isFinite(candidate.editorFontSize)) {
result.editorFontSize = Math.max(9, Math.min(32, Math.round(candidate.editorFontSize)));
}
if (typeof candidate.terminalShell === 'string') {
const shell = candidate.terminalShell.trim().toLowerCase();
if (TERMINAL_SHELL_VALUES.has(shell)) result.terminalShell = shell;
@@ -104,6 +104,16 @@ describe('settings helpers', () => {
expect(helpers.sanitizeSettingsUpdate({ collapsibleUserMessages: 'true' })).toEqual({});
});
it('sanitizes and returns the persisted editor font size', () => {
const helpers = createTestHelpers();
expect(helpers.sanitizeSettingsUpdate({ editorFontSize: 20.6 })).toEqual({ editorFontSize: 21 });
expect(helpers.sanitizeSettingsUpdate({ editorFontSize: 8 })).toEqual({ editorFontSize: 9 });
expect(helpers.sanitizeSettingsUpdate({ editorFontSize: 33 })).toEqual({ editorFontSize: 32 });
expect(helpers.sanitizeSettingsUpdate({ editorFontSize: Number.NaN })).toEqual({});
expect(helpers.formatSettingsResponse({ editorFontSize: 20 })).toMatchObject({ editorFontSize: 20 });
});
it('accepts messageStreamTransport as a persisted shared setting', () => {
const helpers = createTestHelpers();