Skip to content

Commit

Permalink
Merge pull request #2176 from ericoporto/fix-editor-char-style
Browse files Browse the repository at this point in the history
Editor: fix char style has wrong back color
  • Loading branch information
ivan-mogilko authored Oct 15, 2023
2 parents b2859f9 + 766b9f3 commit 7a55820
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Editor/AGS.Editor/Panes/ScintillaWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,23 @@ public enum WordListType
private int _calltipFontSize = Factory.AGSEditor.Settings.ScriptTipFontSize;
private ColorTheme _theme;

private void UpdateColorTheme()
private void UpdateColorThemeStyleDefault()
{
if (_theme == null) return;
ColorTheme t = _theme;

if (!t.Has("script-editor/text-editor")) return;
t.SetColor("script-editor/text-editor/global-default/background", c => scintillaControl1.Styles[Style.Default].BackColor = c);
t.SetColor("script-editor/text-editor/global-default/foreground", c => scintillaControl1.Styles[Style.Default].ForeColor = c);
}

private void UpdateColorTheme()
{
if (_theme == null) return;
ColorTheme t = _theme;

if (!t.Has("script-editor/text-editor")) return;
UpdateColorThemeStyleDefault();
t.SetColor("script-editor/text-editor/default/background", c => scintillaControl1.Styles[Style.Cpp.Default].BackColor = c);
t.SetColor("script-editor/text-editor/default/foreground", c => scintillaControl1.Styles[Style.Cpp.Default].ForeColor = c);
t.SetColor("script-editor/text-editor/word-1/background", c => scintillaControl1.Styles[Style.Cpp.Word].BackColor = c);
Expand Down Expand Up @@ -256,8 +265,9 @@ public void UpdateAllStyles()

this.scintillaControl1.Styles[Style.Default].Font = _scriptFont;
this.scintillaControl1.Styles[Style.Default].Size = _scriptFontSize;
UpdateColorThemeStyleDefault();

scintillaControl1.StyleClearAll();
scintillaControl1.StyleClearAll(); // propagates default style to other styles

this.scintillaControl1.Styles[Style.BraceBad].Font = _scriptFont;
this.scintillaControl1.Styles[Style.BraceBad].Size = _scriptFontSize;
Expand Down

0 comments on commit 7a55820

Please sign in to comment.