1
0
mirror of https://github.com/gizak/termui.git synced 2025-04-24 13:48:50 +08:00

More table scrolling options

This commit is contained in:
Ayooluwa Isaiah 2020-08-25 20:02:01 +01:00
parent cc62c7257c
commit 06a0332374
No known key found for this signature in database
GPG Key ID: 08CF071B5764D484

View File

@ -189,10 +189,30 @@ func (self *Table) ScrollDown() {
self.ScrollAmount(1)
}
func (self *Table) ScrollFirst() {
func (self *Table) ScrollTop() {
self.SelectedRow = 1
}
func (self *Table) ScrollLast() {
func (self *Table) ScrollBottom() {
self.SelectedRow = len(self.Rows) - 1
}
func (self *Table) ScrollPageUp() {
if self.SelectedRow > self.topRow {
self.SelectedRow = self.topRow
} else {
self.ScrollAmount(-self.Inner.Dy())
}
}
func (self *Table) ScrollPageDown() {
self.ScrollAmount(self.Inner.Dy())
}
func (self *Table) ScrollHalfPageUp() {
self.ScrollAmount(-int(FloorFloat64(float64(self.Inner.Dy()) / 2)))
}
func (self *Table) ScrollHalfPageDown() {
self.ScrollAmount(int(FloorFloat64(float64(self.Inner.Dy()) / 2)))
}