From 18b50a05ab5e60cd7c2082939dc9c6a3c90a7ef3 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 10 Dec 2015 17:30:18 -0500 Subject: [PATCH] Handle `Indexed` inside `annotatedToRows`. --- src/Split.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Split.hs b/src/Split.hs index 6f22f409d..9f39b08f8 100644 --- a/src/Split.hs +++ b/src/Split.hs @@ -149,16 +149,16 @@ annotatedToRows :: Annotated a (Info, Info) (Diff a Info) -> String -> String -> annotatedToRows (Annotated (Info left _ leftCategories, Info right _ rightCategories) syntax) before after = (rows syntax, (left, right)) where rows (Leaf _) = zipWithMaybe rowFromMaybeRows leftElements rightElements + rows (Indexed i) = wrapRows i + leftElements = (elementAndBreak $ Span (classify leftCategories)) =<< actualLines (substring left before) rightElements = (elementAndBreak $ Span (classify rightCategories)) =<< actualLines (substring right after) -annotatedToRows (Annotated (Info left _ leftCategories, Info right _ rightCategories) (Indexed i)) before after = (rewrap <$> rows, ranges) - where + wrapRows = fmap rewrap . appendRemainder . foldl sumRows ([], starts ranges) wrap _ EmptyLine = EmptyLine wrap f (Line elements) = Line [ f elements ] rewrap (Row left right) = Row (wrap (Ul $ classify leftCategories) left) (wrap (Ul $ classify rightCategories) right) ranges = (left, right) - rows = appendRemainder $ foldl sumRows ([], starts ranges) i sources = (before, after) appendRemainder (rows, previousIndices) = reverse . foldl adjoin2 [] $ rows ++ (contextRows (ends ranges) previousIndices sources) sumRows (rows, previousIndices) child = (allRows, ends childRanges)