mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Correct rangesOfWordsFrom to produce start/end ranges, not start/length ranges.
This commit is contained in:
parent
1bdfa51702
commit
58830283d4
@ -18,8 +18,8 @@ rangesOfWordsFrom :: Int -> String -> [Range]
|
||||
rangesOfWordsFrom startIndex string = case break Char.isSpace string of
|
||||
([], []) -> []
|
||||
([], rest) -> rangesOfWordsAfterWhitespace startIndex rest
|
||||
(word, []) -> [ Range startIndex $ length word ]
|
||||
(word, rest) -> (Range startIndex $ length word) : rangesOfWordsAfterWhitespace (startIndex + length word) rest
|
||||
(word, []) -> [ Range startIndex $ startIndex + length word ]
|
||||
(word, rest) -> (Range startIndex $ startIndex + length word) : rangesOfWordsAfterWhitespace (startIndex + length word) rest
|
||||
where
|
||||
rangesOfWordsAfterWhitespace startIndex string | (whitespace, rest) <- break (not . Char.isSpace) string = rangesOfWordsFrom (startIndex + length whitespace) rest
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user