diff --git a/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogic.java b/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogic.java index 53640118526..89567ec3a0a 100644 --- a/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogic.java +++ b/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogic.java @@ -359,7 +359,17 @@ private int replaceAll() { executeInForwardMode(() -> { executeWithReplaceAllEnabled(() -> { Point currentSelection = new Point(0, 0); + int lastFoundPosition = -1; + while (findAndSelect(currentSelection.x + currentSelection.y) != -1) { + Point foundMatch = target.getSelection(); + + if (foundMatch.x == lastFoundPosition) { + currentSelection = new Point(foundMatch.x + Math.max(1, foundMatch.y), 0); + continue; + } + + lastFoundPosition = foundMatch.x; currentSelection = replaceSelection(); replacements.add(currentSelection); }