diff --git a/src/search/FindInFiles.js b/src/search/FindInFiles.js index 6249257de74..83ca21a6853 100644 --- a/src/search/FindInFiles.js +++ b/src/search/FindInFiles.js @@ -148,7 +148,7 @@ define(function (require, exports, module) { while ((match = queryExpr.exec(contents)) !== null) { lineNum = StringUtils.offsetToLineNum(lines, match.index); line = lines[lineNum]; - ch = match.index - contents.lastIndexOf("\n", match.index) - 1; // 0-based index + ch = match.index - contents.lastIndexOf("\n", match.index - 1) - 1; // 0-based index matchedLines = match[0].split("\n"); numMatchedLines = matchedLines.length; totalMatchLength = match[0].length;