Browse Source

Fix scrolling Table with PageDown and PageUp

tablepad v1.4.3
Trevor Slocum 2 years ago
parent
commit
b4090e9215
  1. 3
      CHANGELOG
  2. 8
      table.go

3
CHANGELOG

@ -1,6 +1,7 @@ @@ -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)

8
table.go

@ -1160,26 +1160,26 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi @@ -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
}
}
)

Loading…
Cancel
Save