From 8cbe4e39fb8409606140f9f70512fcef3a4861cd Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Dec 2015 18:37:19 -0500 Subject: [PATCH] Use showLines to render leading context. --- src/PatchOutput.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PatchOutput.hs b/src/PatchOutput.hs index 8074be164..80f021351 100644 --- a/src/PatchOutput.hs +++ b/src/PatchOutput.hs @@ -41,7 +41,7 @@ showHunk :: (Source Char, Source Char) -> Hunk (SplitDiff a Info) -> String showHunk sources hunk = header hunk ++ concat (showChange sources <$> changes hunk) ++ concat (showRow sources <$> trailingContext hunk) showChange :: (Source Char, Source Char) -> Change (SplitDiff a Info) -> String -showChange sources change = concat (showRow sources <$> context change) ++ showLines (fst sources) '-' (unLeft <$> contents change) ++ showLines (snd sources) '+' (unRight <$> contents change) +showChange sources change = showLines (snd sources) ' ' (unRight <$> context change) ++ showLines (fst sources) '-' (unLeft <$> contents change) ++ showLines (snd sources) '+' (unRight <$> contents change) showLines :: Source Char -> Char -> [Line (SplitDiff leaf Info)] -> String showLines source prefix lines = fromMaybe "" . mconcat $ fmap (prefix :) . showLine source <$> lines