From 6bed69f3b71eb773d17bdd22a7247ae02f871940 Mon Sep 17 00:00:00 2001 From: Akarshit Wal Date: Fri, 5 Feb 2016 02:32:35 +0530 Subject: [PATCH] Checked if the string to replace contains the string searched --- app/src/processing/app/ui/FindReplace.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/processing/app/ui/FindReplace.java b/app/src/processing/app/ui/FindReplace.java index 2f7301b21..0c5846973 100644 --- a/app/src/processing/app/ui/FindReplace.java +++ b/app/src/processing/app/ui/FindReplace.java @@ -452,8 +452,10 @@ public class FindReplace extends JFrame { // you couldn't seriously be replacing 50K times o_O while (--c > 0) { if (find(false, false)) { - if(editor.getSketch().getCurrentCodeIndex() == startTab - && editor.getSelectionStart() == startIndex){ + if (editor.getSketch().getCurrentCodeIndex() == startTab + && (editor.getSelectionStart() >= startIndex && (editor + .getSelectionStart() <= startIndex + + replaceField.getText().length()))) { // we've reached where we started, so stop the replace Toolkit.beep(); editor.statusNotice("Reached beginning of search!");