From 8d951655f3ac1e3d2bdf62af4791323e53dbc7cf Mon Sep 17 00:00:00 2001 From: Naveen Choudhary Date: Fri, 18 May 2018 16:25:20 +0530 Subject: [PATCH] Fixing issue 14163, find and replace replaces all content of file when replacing new line (#14175) --- src/search/FindInFiles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;