mirror of
https://github.com/github/semantic.git
synced 2025-01-04 21:47:07 +03:00
Define splitTermByLines over actualLineRanges.
This commit is contained in:
parent
6088777b69
commit
aa0dd5d2ca
@ -152,8 +152,7 @@ diffToRows (Pure (Replace a b)) _ before after = (replacedRows, (leftRange, righ
|
||||
splitTermByLines :: Term a Info -> String -> ([Line (Term a Info)], Range)
|
||||
splitTermByLines (Info range categories :< syntax) source = flip (,) range $ case syntax of
|
||||
Leaf a -> reverse . foldl (adjoinLinesBy $ openTerm source) [] $
|
||||
Line True . (:[]) . (:< Leaf a) . (`Info` categories) <$> scanl toRange (Range (start range) (start range)) (actualLines $ substring range source)
|
||||
where toRange previous string = Range (end previous) $ end previous + length string
|
||||
Line True . (:[]) . (:< Leaf a) . (`Info` categories) <$> actualLineRanges range source
|
||||
|
||||
-- | Takes a term and a `source` and returns a list of lines and their range within `source`.
|
||||
termToLines :: Term a Info -> String -> ([Line HTML], Range)
|
||||
|
Loading…
Reference in New Issue
Block a user