mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[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
This commit is contained in:
committed by
intellij-monorepo-bot
parent
dc503d46fb
commit
3b083c8c48
@@ -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<TerminalFontSettingsState>()
|
||||
|
||||
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<TerminalFontSettingsState>()
|
||||
|
||||
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<TerminalFontSettingsState>()
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user