From 3b083c8c4832b01113cebfb3e6ba05bc55aa99b2 Mon Sep 17 00:00:00 2001 From: Konstantin Hudyakov Date: Wed, 11 Jun 2025 12:16:21 +0300 Subject: [PATCH] [terminal] IJPL-188621 Use console font preferences as the base when we update font settings Take the console font preferences from the right place. Can't say that it fixes something, but this approach is more consistent with existing logic in `noStateLoaded`. GitOrigin-RevId: ed26530709e40dff582c6b6fb188db28b2360e90 --- .../terminal/TerminalFontSettingsService.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalFontSettingsService.kt b/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalFontSettingsService.kt index 4995a6f33a88..8701354106d3 100644 --- a/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalFontSettingsService.kt +++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalFontSettingsService.kt @@ -9,7 +9,6 @@ import com.intellij.openapi.components.Storage import com.intellij.openapi.components.service import com.intellij.openapi.editor.colors.EditorColorsManager import com.intellij.openapi.editor.colors.FontPreferences -import com.intellij.openapi.editor.colors.impl.AppConsoleFontOptions import com.intellij.openapi.editor.colors.impl.AppEditorFontOptions import com.intellij.openapi.editor.colors.impl.AppFontOptions import com.intellij.openapi.editor.colors.impl.FontPreferencesImpl @@ -53,7 +52,7 @@ class TerminalFontSettingsService : AppFontOptions() val newPreferences = FontPreferencesImpl() // start with the console preferences as the default - AppConsoleFontOptions.getInstance().fontPreferences.copyTo(newPreferences) + getConsoleFontPreferences().copyTo(newPreferences) // then overwrite the subset that the terminal settings provide settings.copyTo(newPreferences) // then apply the settings that aren't a part of FontPreferences @@ -92,9 +91,8 @@ class TerminalFontSettingsService : AppFontOptions() override fun noStateLoaded() { // the state is mostly inherited from the console settings - val colorsManager = EditorColorsManager.getInstance() - val currentScheme = colorsManager.activeVisibleScheme ?: colorsManager.defaultScheme - val defaultState = TerminalFontSettingsState(currentScheme.consoleFontPreferences) + val consolePreferences = getConsoleFontPreferences() + val defaultState = TerminalFontSettingsState(consolePreferences) // except the line spacing: it is only inherited if it's different from the default, otherwise we use our own default val userSetConsoleLineSpacing = TerminalLineSpacing.ofFloat(defaultState.LINE_SPACING) val defaultConsoleLineSpacing = TerminalLineSpacing.ofFloat(FontPreferences.DEFAULT_LINE_SPACING) @@ -104,6 +102,12 @@ class TerminalFontSettingsService : AppFontOptions() loadState(defaultState) } + private fun getConsoleFontPreferences(): FontPreferences { + val colorsManager = EditorColorsManager.getInstance() + val currentScheme = colorsManager.activeVisibleScheme ?: colorsManager.defaultScheme + return currentScheme.consoleFontPreferences + } + private fun fireListeners() { for (listener in listeners) { listener.fontSettingsChanged()