Skip to content

Commit 52ed127

Browse files
chore: ensure no underflow on page bottom
1 parent 409cec5 commit 52ed127

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cli/cliui/select.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@ func (m selectModel) viewableOptions() ([]string, int) {
219219
case m.cursor <= halfHeight:
220220
top = min(top, m.height)
221221
case m.cursor < top-halfHeight:
222-
bottom = m.cursor - halfHeight
222+
bottom = max(0, m.cursor-halfHeight)
223223
top = min(top, m.cursor+halfHeight+1)
224224
default:
225-
bottom = top - m.height
225+
bottom = max(0, top-m.height)
226226
}
227227

228228
return options[bottom:top], bottom

0 commit comments

Comments
 (0)