1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Show the deleted/inserted line counts.

This commit is contained in:
Rob Rix 2015-12-18 08:12:49 -05:00
parent e22f951038
commit 33aabea60c

View File

@ -8,7 +8,7 @@ patch diff sourceA sourceB = mconcat $ hunks diff sourceA sourceB
data Hunk = Hunk Int Int [Line]
header :: Hunk -> String
header (Hunk offsetA offsetB lines) = "@@ -" ++ show offsetA ++ " +" ++ show offsetB ++ " @@\n"
header (Hunk offsetA offsetB lines) = "@@ -" ++ show offsetA ++ "," ++ show countDeleted ++ " +" ++ show offsetB ++ "," ++ show countInserted ++ " @@\n"
where (countDeleted, countInserted) = foldl countLine (0, 0) lines
countLine (countDeleted, countInserted) line = case line of
Insert _ -> (countDeleted, countInserted + 1)