Permalink
Browse files

Update lib/util/searchcursor.js

fix reverse Regexp match which cause memory leak
  • Loading branch information...
1 parent 19f0d06 commit cc6079bc5d028d042f5e863062bc7ab530e52684 @feizhang365 feizhang365 committed with marijnh Sep 24, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/util/searchcursor.js
View
@@ -17,14 +17,14 @@
query.lastIndex = 0;
var line = cm.getLine(pos.line).slice(0, pos.ch), match = query.exec(line), start = 0;
while (match) {
- start += match.index;
- line = line.slice(match.index);
+ start += match.index + 1;
+ line = line.slice(start);
query.lastIndex = 0;
var newmatch = query.exec(line);
if (newmatch) match = newmatch;
else break;
- start++;
}
+ start--;
} else {
query.lastIndex = pos.ch;
var line = cm.getLine(pos.line), match = query.exec(line),

0 comments on commit cc6079b

Please sign in to comment.