Fix segfault in lineHome

This commit is contained in:
Sasha Koshka 2024-09-04 12:30:36 -04:00
parent 70d6759884
commit 9079aca993

View File

@ -619,10 +619,10 @@ func nextParagraph (text []rune, index int) int {
}
// TODO: make functions on top of these that support soft home/end
// FIXME: these break near the start and end of the box
func lineHome (text []rune, index int) int {
liminal := index < len(text) && text[index] == '\n'
if index >= len(text) { index = len(text) - 1 }
for index := index; index >= 0; index -- {
char := text[index]
if char == '\n' && !liminal {