1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 16:02:43 +03:00

Compute the maximum value in each element correctly.

This commit is contained in:
Rob Rix 2016-05-13 18:44:27 -04:00
parent 9567c44c57
commit 2008b63c17

View File

@ -130,7 +130,7 @@ data PrettyDiff = PrettyDiff { unPrettySources :: Both (Source.Source Char), unP
deriving Eq
instance Show PrettyDiff where
show (PrettyDiff sources lines) = showLine (maximum (0 : (length <$> shownLines))) <$> shownLines >>= ('\n':)
show (PrettyDiff sources lines) = showLine (maximum (0 : (maximum . fmap length <$> shownLines))) <$> shownLines >>= ('\n':)
where shownLines = catMaybes $ toBoth <$> lines
showLine n line = uncurry ((++) . (++ " | ")) (fromThese (replicate n ' ') (replicate n ' ') (runJoin (pad n <$> line)))
showDiff diff = filter (/= '\n') . toList . Source.slice (getRange diff)