@@ -1294,7 +1294,7 @@ func (l *list[T]) findWordBoundaries(col, line int) (startCol, endCol int) {
12941294 lines[i] = ansi.Strip(l)
12951295 }
12961296
1297− if l.direction == DirectionBackward {
1297+ if l.direction == DirectionBackward && len(lines) > l.height {
12981298 line = ((len(lines) - 1) - l.height) + line + 1
12991299 }
13001300
@@ -1336,7 +1336,7 @@ func (l *list[T]) findParagraphBoundaries(line int) (startLine, endLine int, fou
13361336 lines[i] = strings.ReplaceAll(lines[i], icon, " ")
13371337 }
13381338 }
1339− if l.direction == DirectionBackward {
1339+ if l.direction == DirectionBackward && len(lines) > l.height {
13401340 line = (len(lines) - 1) - l.height + line + 1
13411341 }
13421342
@@ -1370,7 +1370,7 @@ func (l *list[T]) findParagraphBoundaries(line int) (startLine, endLine int, fou
13701370 }
13711371
13721372 // revert the line numbers if we are in backward direction
1373− if l.direction == DirectionBackward {
1373+ if l.direction == DirectionBackward && len(lines) > l.height {
13741374 startLine = startLine - (len(lines) - 1) + l.height - 1
13751375 endLine = endLine - (len(lines) - 1) + l.height - 1
13761376 }