Fix scrolling Table with PageDown and PageUp

This commit is contained in:
Trevor Slocum 2020-02-13 09:54:18 -08:00
parent c6f9bcda29
commit b4090e9215
2 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,7 @@
v1.4.3 (WIP)
v1.4.3 (2020-02-13)
- Add SetFocusedFunc to TreeNode
- Add option to always show scroll bar
- Fix scrolling Table with PageDown and PageUp
- Do not wrap around list by default
v1.4.2 (2020-02-02)

View File

@ -1160,26 +1160,26 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi
pageDown = func() {
if t.rowsSelectable {
t.selectedRow += t.visibleRows
t.selectedRow += t.visibleRows - t.fixedRows
if t.selectedRow >= len(t.cells) {
t.selectedRow = len(t.cells) - 1
}
next()
} else {
t.rowOffset += t.visibleRows
t.rowOffset += t.visibleRows - t.fixedRows
}
}
pageUp = func() {
if t.rowsSelectable {
t.selectedRow -= t.visibleRows
t.selectedRow -= t.visibleRows - t.fixedRows
if t.selectedRow < 0 {
t.selectedRow = 0
}
previous()
} else {
t.trackEnd = false
t.rowOffset -= t.visibleRows
t.rowOffset -= t.visibleRows - t.fixedRows
}
}
)