Skip to content

Commit 13b33ef

Browse files
Fix for #51 Wrong result of JsDiff.diffLines
1 parent b7f143c commit 13b33ef

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

diff.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,8 @@
270270
lastLineLastChar = lastLine ? lastLine[lastLine.length - 1] : '';
271271

272272
// Merge lines that may contain windows new lines
273-
if (line === '\n' && (lastLineLastChar === '\r' || lastLineLastChar === '\n')) {
274-
if (this.ignoreTrim || lastLineLastChar === '\n'){
275-
//to avoid merging to \n\n, remove \n and add \r\n.
273+
if (line === '\n' && lastLineLastChar === '\r') {
276274
retLines[retLines.length - 1] = retLines[retLines.length - 1].slice(0,-1) + '\r\n';
277-
} else {
278-
retLines[retLines.length - 1] += '\n';
279-
}
280275
} else if (line) {
281276
if (this.ignoreTrim) {
282277
line = line.trim();

0 commit comments

Comments
 (0)