Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
stop searching a file once we reach max hits
Browse files Browse the repository at this point in the history
  • Loading branch information
redmunds committed Oct 15, 2012
1 parent c0a7d31 commit 0092d1d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/search/FindInFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ define(function (require, exports, module) {
end: {line: lineNum, ch: ch + matchLength},
line: line
});

// We have the max hits in just this 1 file. Stop searching.
if (matches.length >= FIND_IN_FILES_MAX) {
break;
}
}

return matches;
Expand Down Expand Up @@ -320,6 +325,7 @@ define(function (require, exports, module) {

DocumentManager.getDocumentForPath(fileInfo.fullPath)
.done(function (doc) {
console.log("doFindInFiles: " + fileInfo.fullPath);
var matches = _getSearchMatches(doc.getText(), queryExpr);

if (matches && matches.length) {
Expand Down

0 comments on commit 0092d1d

Please sign in to comment.