Fix: replace-all now handles the case where new string contains the old one as a...
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 13 Dec 2013 10:22:14 +0000 (11:22 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 13 Dec 2013 10:22:14 +0000 (11:22 +0100)
This led to infinite loop.

redakcja/static/js/wiki/view_search.js

index ae0fd2d..21127dc 100644 (file)
         else {}
         self.searchCursor.select();
         self.searchCursor.replace(query);
         else {}
         self.searchCursor.select();
         self.searchCursor.replace(query);
-        var found = self.search();
-        if(self.options['replace-all']) {
-            while(found) {
-                self.replace();
-                found = self.search();
-            }
+        if(self.options['replace-all'] && self.search()) {
+            self.replace();
         }
     };
 
         }
     };