Skip to content

Commit 0e5bed8

Browse files
Stop treating stuff like vertical tabs as line breaks when dealing with unified diffs
1 parent 4507160 commit 0e5bed8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/patch/apply.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export function applyPatch(source, uniDiff, options = {}) {
1515
}
1616

1717
// Apply the diff to the input
18-
let lines = source.split(/\r\n|[\n\v\f\r\x85]/),
19-
delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
18+
let lines = source.split(/\r?\n/),
19+
delimiters = source.match(/\r?\n/g) || [],
2020
hunks = uniDiff.hunks,
2121

2222
compareLine = options.compareLine || ((lineNumber, line, operation, patchContent) => line === patchContent),

src/patch/parse.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export function parsePatch(uniDiff, options = {}) {
2-
let diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
3-
delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
2+
let diffstr = uniDiff.split(/\r?\n/),
3+
delimiters = uniDiff.match(/\r?\n/g) || [],
44
list = [],
55
i = 0;
66

0 commit comments

Comments
 (0)