We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03deb09 commit 816565dCopy full SHA for 816565d
analysis/src/Pos.ml
@@ -22,8 +22,8 @@ let positionToOffset text (line, character) =
22
match offsetOfLine text line with
23
| None -> None
24
| Some bol ->
25
- if bol + character <= String.length text then Some (bol + character)
26
- else None
+ let offset = bol + character in
+ if offset >= 0 && offset <= String.length text then Some offset else None
27
28
let posBeforeCursor pos = (fst pos, max 0 (snd pos - 1))
29
0 commit comments