Skip to content

Fix custom Text Editor theme changes on reload #107918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2025

Conversation

kitbdev
Copy link
Contributor

@kitbdev kitbdev commented Jun 23, 2025

When the EditorSettings loads defaults, I replaced the call to _load_godot2_text_editor_theme with EDITOR_SETTING*, this is so the text editor theme settings always saves to the editor settings file, just like the editor theme settings does. This is important when loading and the preset is Custom.
The _load_godot2_text_editor_theme should probably be moved to the editor theme manager in the future, for now I left it as is since the text editor theme loading still uses it.

I wanted to have the EditorSettingsDialog immediately update so the revert icons show, but I ran into an issue with the ColorPickerButton completely freezing the dialog if it was open while reloading. As before, they only reload when reopening the category or the dialog. It shouldn't cause any issues that they aren't immediately updated, since it is just for the revert buttons.

The initial values for the Custom preset are now the current Default theme. So if you were on Godot 2 and change to Custom, all of the values can be reverted, and the same from Default if the editor's base color changes, since Default changes based on it.

@kitbdev kitbdev added this to the 4.5 milestone Jun 23, 2025
@kitbdev kitbdev requested a review from a team as a code owner June 23, 2025 23:50
@kitbdev kitbdev added the bug label Jun 23, 2025
@kitbdev kitbdev requested a review from a team as a code owner June 23, 2025 23:50
@KoBeWi
Copy link
Member

KoBeWi commented Jun 29, 2025

Why do _load_defaults() and _load_godot2_text_editor_theme() initialize the same values?

@kitbdev
Copy link
Contributor Author

kitbdev commented Jun 29, 2025

I plan to move _load_godot2_text_editor_theme to EditorThemeManager or at least change it to use set_initial_value instead. _load_godot2_text_editor_theme is used when changing the theme, but the first initializing needs to use EDITOR_SETTING.
The color for the base theme does similar, there is a value set here in EditorSettings, and again in EditorThemeManager.

Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

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

You can introduce some struct Godot2Theme or something, which would have constants to use for default values. Defining them twice is not very maintainable.

Although if you plan to clean it up then it's probably fine for now. This fixes the bug at least.

@kitbdev kitbdev force-pushed the fix-text-editor-theme-reload branch from 206de5f to 45ec6b4 Compare June 30, 2025 13:35
@kitbdev kitbdev force-pushed the fix-text-editor-theme-reload branch from 45ec6b4 to ed5a986 Compare June 30, 2025 13:46
@Repiteo Repiteo merged commit 762305f into godotengine:master Jul 1, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Jul 1, 2025

Thanks!

@kitbdev kitbdev deleted the fix-text-editor-theme-reload branch July 4, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modifying colors of the text editor theme highlightings causes non-modified colors to change without user input upon project reload.
4 participants