GT-2716 - Decompiler - Fixed 'Find' highlight ghosts

This commit is contained in:
dragonmacher 2019-04-01 18:25:05 -04:00
parent 7179c6de81
commit 1626d2ee1b
11 changed files with 94 additions and 39 deletions

View file

@ -15,8 +15,6 @@
*/
package ghidra.app.plugin.core.byteviewer;
import ghidra.util.ColorUtils;
import java.awt.*;
import java.math.BigInteger;
@ -28,6 +26,7 @@ import docking.widgets.fieldpanel.internal.FieldBackgroundColorManager;
import docking.widgets.fieldpanel.internal.PaintContext;
import docking.widgets.fieldpanel.support.HighlightFactory;
import docking.widgets.fieldpanel.support.RowColLocation;
import ghidra.util.ColorUtils;
/**
* Fields for the ByteViewer. This class extends the SimpleTextField to include
@ -52,7 +51,8 @@ public class ByteField extends SimpleTextField {
* @param hlFactory the factory used to create highlights
*/
public ByteField(String text, FontMetrics fontMetrics, int startX, int width,
boolean allowCursorAtEnd, int fieldOffset, BigInteger index, HighlightFactory hlFactory) {
boolean allowCursorAtEnd, int fieldOffset, BigInteger index,
HighlightFactory hlFactory) {
super(text, fontMetrics, startX, width, allowCursorAtEnd, hlFactory);
this.fieldOffset = fieldOffset;
@ -64,7 +64,7 @@ public class ByteField extends SimpleTextField {
public void paint(JComponent c, Graphics g, PaintContext context,
FieldBackgroundColorManager colorManager, RowColLocation cursorLoc, int rowHeight) {
paintSelection(g, colorManager, 0);
paintHighlights(g, hlFactory.getHighlights(text, -1));
paintHighlights(g, hlFactory.getHighlights(this, text, -1));
g.setFont(metrics.getFont());
if (foregroundColor == null) {
foregroundColor = context.getForeground();