From: Aleksander Ɓukasz Date: Fri, 13 Dec 2013 10:22:14 +0000 (+0100) Subject: Fix: replace-all now handles the case where new string contains the old one as a... X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/995d7d01ab2f1a0a378fcf180f069845a454689a?ds=inline Fix: replace-all now handles the case where new string contains the old one as a substring This led to infinite loop. --- diff --git a/redakcja/static/js/wiki/view_search.js b/redakcja/static/js/wiki/view_search.js index ae0fd2db..21127dc3 100644 --- a/redakcja/static/js/wiki/view_search.js +++ b/redakcja/static/js/wiki/view_search.js @@ -90,12 +90,8 @@ 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(); } };