1
0
mirror of https://github.com/rivo/tview.git synced 2025-04-24 13:48:56 +08:00

Merge pull request #418 from abitrolly/patch-2

Use List height for scrolling with PgUp/PgDn
This commit is contained in:
rivo 2020-04-14 13:53:51 +02:00 committed by GitHub
commit ba71c7df7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -499,9 +499,11 @@ func (l *List) InputHandler() func(event *tcell.EventKey, setFocus func(p Primit
case tcell.KeyEnd:
l.currentItem = len(l.items) - 1
case tcell.KeyPgDn:
l.currentItem += 5
_, _, _, height := l.GetInnerRect()
l.currentItem += height
case tcell.KeyPgUp:
l.currentItem -= 5
_, _, _, height := l.GetInnerRect()
l.currentItem -= height
case tcell.KeyEnter:
if l.currentItem >= 0 && l.currentItem < len(l.items) {
item := l.items[l.currentItem]