Commit efdabf7b authored by Fredrik Wieczerkowski's avatar Fredrik Wieczerkowski
Browse files

Handle out-of-bounds lines in span previews

parent 1b630439
......@@ -87,7 +87,9 @@ ppSpanPreview (Span f (Position _ sl sc) (Position _ el ec))
| otherwise = do
fileContents <- readFile f
let lnContent = lines fileContents !! (sl - 1)
let lns = lines fileContents
lnContent | any (\l -> l <= 0 || l > length lns) [sl, el] = ""
| otherwise = lns !! (sl - 1)
lnNum = text <$> lPadStr lnNumWidth <$> (vPad ++ [show sl] ++ vPad)
ec' = if isMultiline then length lnContent else ec
gutter = text <$> replicate (1 + 2 * vPadCount) "|"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment