mirror of https://github.com/rivo/tview
Fix inverted handling of KeyPgDn/KeyPgUp in List widget
Consider a list with 5 items, and the currentItem index is 2, and all items fit on the screen without scrolling. KeyPgDn will set currentItem to 7 which is out of bounds, and gets wrapped around to 0. KeyPgUp will set currentItem to -3 which is out of bounds, and gets wrapped around to 4. Thus PgDn selects the first item, while PgUp selects the last item, which is the opposite of expected behaviour for these keys. Fix this by clamping currentItem to the boundaries in the key handler. Fixes: https://github.com/rivo/tview/issues/580 Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>pull/581/head
parent
ae9464cc35
commit
0bca6dadb3
Loading…
Reference in New Issue