on main help sign in
chore: handle smaller text than screen size
d8da2fbKujtim Hoxha
internal/tui/exp/list/list.go+3−3
@@ -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)
1295 }
1295 }
1296
1296
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
1299 }
1299 }
1300
1300
@@ -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, " ")
1337 }
1337 }
1338 }
1338 }
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
1341 }
1341 }
1342
1342
@@ -1370,7 +1370,7 @@ func (l *list[T]) findParagraphBoundaries(line int) (startLine, endLine int, fou
1370 }
1370 }
1371
1371
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
1376 }
1376 }