1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

Filter newlines out completely.

This commit is contained in:
Rob Rix 2016-04-25 14:54:13 -04:00
parent ca3ff15a4f
commit 7628d15a73

View File

@ -121,7 +121,7 @@ instance Show PrettyDiff where
This before -> pad n before " | " This before -> pad n before " | "
That after -> showString (replicate n ' ') (showString " | " after) That after -> showString (replicate n ' ') (showString " | " after)
These before after -> pad n before (showString " | " after) These before after -> pad n before (showString " | " after)
showDiff diff = toList . stripNewlines . Source.slice (getRange diff) showDiff diff = stripNewlines . toList . Source.slice (getRange diff)
stripNewlines = fmap (\ c -> if c == '\n' then ' ' else c) stripNewlines = filter (/= '\n')
pad n string = showString (take n string) . showString (replicate (max 0 (n - length string)) ' ') pad n string = showString (take n string) . showString (replicate (max 0 (n - length string)) ' ')
toBoth them = showDiff <$> them `applyThese` modifyJoin (uncurry These) sources toBoth them = showDiff <$> them `applyThese` modifyJoin (uncurry These) sources