mirror of
https://github.com/github/semantic.git
synced 2024-12-18 12:21:57 +03:00
Represent newlines distinct from empty strings
This commit is contained in:
parent
6426a57d51
commit
5b8908ac82
@ -169,7 +169,7 @@ contextRows childIndices previousIndices sources = zipWithMaybe rowFromMaybeRows
|
||||
textElements :: Range -> String -> [HTML]
|
||||
textElements range source = textOrBreak <$> actualLines s
|
||||
where s = substring range source
|
||||
textOrBreak "" = Break
|
||||
textOrBreak "\n" = Break
|
||||
textOrBreak x = Text x
|
||||
|
||||
starts :: (Range , Range) -> (Int, Int)
|
||||
@ -236,4 +236,6 @@ actualLines "" = [""]
|
||||
actualLines lines = case break (== '\n') lines of
|
||||
(l, lines') -> l : (case lines' of
|
||||
[] -> []
|
||||
_:lines' -> actualLines lines')
|
||||
_:lines' -> (case actualLines lines' of
|
||||
[] -> ["\n"]
|
||||
s:rest -> ('\n' : s) : rest))
|
||||
|
Loading…
Reference in New Issue
Block a user