mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[PR #581] [MERGED] Fix inverted handling of KeyPgDn/KeyPgUp in List widget #988
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#988
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/rivo/tview/pull/581
Author: @berrange
Created: 3/15/2021
Status: ✅ Merged
Merged: 4/26/2021
Merged by: @rivo
Base:
master← Head:pg-keys📝 Commits (1)
0bca6daFix inverted handling of KeyPgDn/KeyPgUp in List widget📊 Changes
1 file changed (+6 additions, -0 deletions)
View changed files
📝
list.go(+6 -0)📄 Description
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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.