fix bug in line_gap.sml: when we convert a line number to an absolute index and travel leftwards, make sure we continue travelling leftwards when the current node is at the correct line number but the line number does not start at this node.
This commit is contained in:
@@ -3308,8 +3308,16 @@ struct
|
|||||||
val prevIdx = curIdx - String.size shd
|
val prevIdx = curIdx - String.size shd
|
||||||
in
|
in
|
||||||
if findLine >= prevLine then
|
if findLine >= prevLine then
|
||||||
let val relativeLine = findLine - prevLine - 1
|
let
|
||||||
in Vector.sub (lhd, relativeLine) + prevIdx
|
val relativeLine = findLine - prevLine - 1
|
||||||
|
in
|
||||||
|
if relativeLine < 0 then
|
||||||
|
(* the line start is not at this node,
|
||||||
|
* so we need to continue going left
|
||||||
|
* to find what index the line start corresponds to *)
|
||||||
|
lineNumberToIdxLeft (findLine, prevIdx, prevLine, stl, ltl)
|
||||||
|
else
|
||||||
|
Vector.sub (lhd, relativeLine) + prevIdx
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
lineNumberToIdxLeft (findLine, prevIdx, prevLine, stl, ltl)
|
lineNumberToIdxLeft (findLine, prevIdx, prevLine, stl, ltl)
|
||||||
|
|||||||
Reference in New Issue
Block a user