Fix segfault in lineHome
This commit is contained in:
parent
70d6759884
commit
9079aca993
@ -619,10 +619,10 @@ func nextParagraph (text []rune, index int) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: make functions on top of these that support soft home/end
|
// 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 {
|
func lineHome (text []rune, index int) int {
|
||||||
liminal := index < len(text) && text[index] == '\n'
|
liminal := index < len(text) && text[index] == '\n'
|
||||||
|
if index >= len(text) { index = len(text) - 1 }
|
||||||
for index := index; index >= 0; index -- {
|
for index := index; index >= 0; index -- {
|
||||||
char := text[index]
|
char := text[index]
|
||||||
if char == '\n' && !liminal {
|
if char == '\n' && !liminal {
|
||||||
|
Loading…
Reference in New Issue
Block a user