Skip to content

Commit

Permalink
Use StyledText for the debugger log
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
garfieldnate committed Jul 22, 2023
1 parent 348e9d3 commit 9ba99a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand All @@ -40,7 +38,7 @@
************************************************************************/
public class FoldingText
{
protected Text m_Text;
protected StyledText m_Text;

protected Canvas m_IconBar;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -1348,7 +1346,7 @@ public Composite getWindow()
return m_Container;
}

public Text getTextWindow()
public StyledText getTextWindow()
{
return m_Text;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9ba99a7

Please sign in to comment.