for LineGap.lineNumberToIdx function, add a branch at the start checking if we are trying to get the idx corresponding to line number 0. This is needed by the current implementation because the 'lineNumberToIdxLeft' function uses (findLine - 1) in the implementation, and (0 - 1) is an invalid line idx as it is below 0.

This commit is contained in:
2025-12-02 23:49:29 +00:00
parent 4126c833d1
commit 4925bcd370

View File

@@ -3341,7 +3341,9 @@ struct
, ... , ...
} = buffer } = buffer
in in
if findLine - 1 < curLine then if findLine = 0 then
0
else if findLine - 1 < curLine then
lineNumberToIdxLeft (findLine, curIdx, curLine, leftStrings, leftLines) lineNumberToIdxLeft (findLine, curIdx, curLine, leftStrings, leftLines)
else else
lineNumberToIdxRight lineNumberToIdxRight