Merge pull request #4271 from Akarshit/bugfix-findReplace

Checked if the string to replace contains the string searched
This commit is contained in:
Ben Fry
2016-02-13 08:33:48 -05:00

View File

@@ -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!");