From 722d2c9a784704d6c31c92f8a5e5ad881783d539 Mon Sep 17 00:00:00 2001 From: Naveen Choudhary Date: Tue, 27 Mar 2018 19:08:05 +0530 Subject: [PATCH] Fixing issue 14163, find and replace replaces all content of file when replacing new line --- 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;