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

add text-icu

This commit is contained in:
joshvera 2015-12-15 16:34:47 -05:00
parent d4b41f8109
commit e80bc4590d
2 changed files with 6 additions and 1 deletions

View File

@ -53,6 +53,7 @@ executable semantic-diff-exe
, optparse-applicative
, filepath
, text >= 1.2.1.3
, text-icu
default-language: Haskell2010
default-extensions: OverloadedStrings
extra-libraries: bridge
@ -74,6 +75,7 @@ executable semantic-diff-profile
, optparse-applicative
, filepath
, text >= 1.2.1.3
, text-icu
default-language: Haskell2010
default-extensions: OverloadedStrings
extra-libraries: bridge

View File

@ -66,7 +66,7 @@ split diff before after = return . TL.toStrict . HText.renderHtml
. (table ! A.class_ "diff")
. mconcat $ toMarkup <$> (reverse $ foldl numberRows [] rows)
where
rows = fst $ diffToRows diff (0, 0) before after
rows = normalizedDiffToRows diff before after
numberRows :: [(Int, Line, Int, Line)] -> Row -> [(Int, Line, Int, Line)]
numberRows [] (Row EmptyLine EmptyLine) = []
@ -78,6 +78,9 @@ split diff before after = return . TL.toStrict . HText.renderHtml
numberRows rows@((leftCount, _, rightCount, _):_) (Row EmptyLine right@(Line _)) = (leftCount, EmptyLine, rightCount + 1, right):rows
numberRows rows@((leftCount, _, rightCount, _):_) (Row left right) = (leftCount + 1, left, rightCount + 1, right):rows
normalizedDiffToRows :: Diff a Info -> T.Text -> T.Text -> [Row]
normalizedDiffToRows diff before after = fst $ diffToRows diff (0, 0) before after
data Row = Row Line Line
deriving Eq