1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

Define splitDiffByLines over Replace patches.

This commit is contained in:
Rob Rix 2015-12-21 23:06:27 -05:00
parent c471a5e779
commit c7e5690da4

View File

@ -136,6 +136,9 @@ splitDiffByLines diff (prevLeft, prevRight) sources = case diff of
(Row EmptyLine <$> lines, (Range prevLeft prevLeft, range))
Pure (Delete term) -> let (lines, range) = splitTermByLines term (fst sources) in
(flip Row EmptyLine <$> lines, (range, Range prevRight prevRight))
Pure (Replace leftTerm rightTerm) -> let (leftLines, leftRange) = splitTermByLines leftTerm (fst sources)
(rightLines, rightRange) = splitTermByLines rightTerm (snd sources) in
(zipWithDefaults Row EmptyLine EmptyLine leftLines rightLines, (leftRange, rightRange))
where categories (Info _ left, Info _ right) = (left, right)
ranges (Info left _, Info right _) = (left, right)