@@ -1294,7 +1294,7 @@ func (l *list[T]) findWordBoundaries(col, line int) (startCol, endCol int) {
1294 lines[i] = ansi.Strip(l)
1294 lines[i] = ansi.Strip(l)
1297− if l.direction == DirectionBackward {
1297+ if l.direction == DirectionBackward && len(lines) > l.height {
1298 line = ((len(lines) - 1) - l.height) + line + 1
1298 line = ((len(lines) - 1) - l.height) + line + 1
@@ -1336,7 +1336,7 @@ func (l *list[T]) findParagraphBoundaries(line int) (startLine, endLine int, fou
1336 lines[i] = strings.ReplaceAll(lines[i], icon, " ")
1336 lines[i] = strings.ReplaceAll(lines[i], icon, " ")
1339− if l.direction == DirectionBackward {
1339+ if l.direction == DirectionBackward && len(lines) > l.height {
1340 line = (len(lines) - 1) - l.height + line + 1
1340 line = (len(lines) - 1) - l.height + line + 1
@@ -1370,7 +1370,7 @@ func (l *list[T]) findParagraphBoundaries(line int) (startLine, endLine int, fou
1372 // revert the line numbers if we are in backward direction
1372 // revert the line numbers if we are in backward direction
1373− if l.direction == DirectionBackward {
1373+ if l.direction == DirectionBackward && len(lines) > l.height {
1374 startLine = startLine - (len(lines) - 1) + l.height - 1
1374 startLine = startLine - (len(lines) - 1) + l.height - 1
1375 endLine = endLine - (len(lines) - 1) + l.height - 1
1375 endLine = endLine - (len(lines) - 1) + l.height - 1