Theme Editor: fixed endless look in "replace all" when replacing e.g. "a" with "aa"

This commit is contained in:
Karl Tauber
2021-08-28 17:37:02 +02:00
parent 651454170d
commit 77f33467d2

View File

@@ -192,9 +192,17 @@ class FlatFindReplaceBar
context.setSearchFor( findField.getText() );
context.setReplaceWith( replaceField.getText() );
// make sure that search wrap is disabled because otherwise it is easy
// to have endeless loop when replacing e.g. "a" with "aa"
boolean oldSearchWrap = context.getSearchWrap();
context.setSearchWrap( false );
// replace all
SearchResult result = SearchEngine.replaceAll( textArea, context );
// restore search wrap
context.setSearchWrap( oldSearchWrap );
// update matches info labels
updateMatchesLabel( result, true );
}