From 9530289cc5452fc3a4c75cf5b5f4ca25cb46fde4 Mon Sep 17 00:00:00 2001 From: Nathan Glenn Date: Sat, 22 Jul 2023 00:13:45 -0500 Subject: [PATCH] Use StyledText for the debugger log `Text` is unfortunately black (or SWT.COLOR_LIST_FOREGROUND) by default, and since we actually ignore the color input from users, users were stuck with black text on dark gray background if they used dark mode. Change to `StyledText`, which correctly shows white on a dark gray background when in dark mode. Fixes #352. --- .../umich/soar/debugger/helpers/FoldingText.java | 14 ++++++-------- .../soar/debugger/modules/AbstractComboView.java | 2 +- .../soar/debugger/modules/AbstractTextView.java | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Java/Debugger/src/edu/umich/soar/debugger/helpers/FoldingText.java b/Java/Debugger/src/edu/umich/soar/debugger/helpers/FoldingText.java index d6ac58ee39..ba62599807 100644 --- a/Java/Debugger/src/edu/umich/soar/debugger/helpers/FoldingText.java +++ b/Java/Debugger/src/edu/umich/soar/debugger/helpers/FoldingText.java @@ -14,15 +14,13 @@ import java.util.ArrayList; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Cursor; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; @@ -40,7 +38,7 @@ ************************************************************************/ public class FoldingText { - protected Text m_Text; + protected StyledText m_Text; protected Canvas m_IconBar; @@ -751,7 +749,7 @@ public FoldingText(Composite parent) // The icon bar is used to paint the "+" signs. It is double-buffered or // we'll get a little flicker effect because we repaint it on a timer. m_IconBar = new Canvas(m_Container, SWT.DOUBLE_BUFFERED); - m_Text = new Text(m_Container, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL + m_Text = new StyledText(m_Container, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY); m_DrawingDisabled = false; @@ -1116,7 +1114,7 @@ public int getCharacterPosition(String text, int mouseX) // We'd like this to not scroll if the cursor is not at the bottom of the // window // and SWT's append method always scrolls. - private void appendTextToWidget(Text widget, String text) + private void appendTextToWidget(StyledText widget, String text) { // If set this to true we just use standard append // and always scroll. @@ -1348,7 +1346,7 @@ public Composite getWindow() return m_Container; } - public Text getTextWindow() + public StyledText getTextWindow() { return m_Text; } diff --git a/Java/Debugger/src/edu/umich/soar/debugger/modules/AbstractComboView.java b/Java/Debugger/src/edu/umich/soar/debugger/modules/AbstractComboView.java index 2f3735dba5..75a194f7c0 100644 --- a/Java/Debugger/src/edu/umich/soar/debugger/modules/AbstractComboView.java +++ b/Java/Debugger/src/edu/umich/soar/debugger/modules/AbstractComboView.java @@ -42,7 +42,7 @@ /******************************************************************************************** * - * This is a base class designed to part of a view. This part handles the combo + * This is a base class designed as part of a view. This part handles the combo * box. Another derived class handles the display of those commands which may be * in text or something else. * diff --git a/Java/Debugger/src/edu/umich/soar/debugger/modules/AbstractTextView.java b/Java/Debugger/src/edu/umich/soar/debugger/modules/AbstractTextView.java index ca24f7c29a..8c76673f9d 100644 --- a/Java/Debugger/src/edu/umich/soar/debugger/modules/AbstractTextView.java +++ b/Java/Debugger/src/edu/umich/soar/debugger/modules/AbstractTextView.java @@ -81,7 +81,7 @@ public void copy() /************************************************************************ * - * Search for the next occurance of 'text' in this view and place the + * Search for the next occurrence of {@code text} in this view and place the * selection at that point. * * @param text