Merge remote-tracking branch 'origin/GP-0-dragonmacher-test-fixes-01-23-25'

This commit is contained in:
Ryan Kurtz 2025-01-23 10:46:55 -05:00
commit ac617a796b

View file

@ -16,8 +16,9 @@
package docking.widgets; package docking.widgets;
import java.awt.*; import java.awt.*;
import java.util.*; import java.util.Collection;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.regex.*; import java.util.regex.*;
import javax.swing.JEditorPane; import javax.swing.JEditorPane;
@ -66,6 +67,8 @@ public class TextComponentSearcher implements FindDialogSearcher {
public void setEditorPane(JEditorPane editorPane) { public void setEditorPane(JEditorPane editorPane) {
if (this.editorPane != editorPane) { if (this.editorPane != editorPane) {
Document document = editorPane.getDocument();
document.removeDocumentListener(documentListener);
markResultsStale(); markResultsStale();
} }
this.editorPane = editorPane; this.editorPane = editorPane;
@ -79,11 +82,13 @@ public class TextComponentSearcher implements FindDialogSearcher {
public void dispose() { public void dispose() {
caretUpdater.dispose(); caretUpdater.dispose();
if (editorPane != null) {
Document document = editorPane.getDocument(); Document document = editorPane.getDocument();
document.removeDocumentListener(documentListener); document.removeDocumentListener(documentListener);
clearHighlights(); clearHighlights();
} }
}
@Override @Override
public void clearHighlights() { public void clearHighlights() {
@ -253,9 +258,7 @@ public class TextComponentSearcher implements FindDialogSearcher {
return; return;
} }
Iterator<FindMatch> it = matchesByPosition.values().iterator(); for (FindMatch match : matchesByPosition.values()) {
while (it.hasNext()) {
FindMatch match = it.next();
boolean isActive = false; boolean isActive = false;
if (match.contains(pos)) { if (match.contains(pos)) {
activeMatch = match; activeMatch = match;