mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-21 16:30:24 +00:00
Do a bounds check for charpos function
This commit is contained in:
parent
55a6b6701d
commit
f730864e9f
1 changed files with 3 additions and 0 deletions
|
|
@ -18,6 +18,9 @@ func FromCharPosStart(startLoc, startX, startY, loc int, buf *Buffer) (int, int)
|
|||
for charNum+lineLen <= loc {
|
||||
charNum += lineLen
|
||||
y++
|
||||
if y >= buf.NumLines {
|
||||
return 0, 0
|
||||
}
|
||||
lineLen = Count(buf.Lines[y]) + 1
|
||||
}
|
||||
x = loc - charNum
|
||||
|
|
|
|||
Loading…
Reference in a new issue