refactor(table): use maxYOffset

This commit is contained in:
bashbunni
2024-09-20 11:09:54 -07:00
parent 791d89b668
commit ee1ba24d7b
+2 -3
View File
@@ -381,7 +381,7 @@ func (m *Model) MoveUp(n int) {
// only set the offset outside of the last available rows.
// TODO use maxYOffset
if m.cursor < len(m.rows)-m.height {
if m.cursor < m.maxYOffset() {
m.YOffset = m.YOffset - n
m.table.Offset(m.YOffset)
}
@@ -425,8 +425,7 @@ func (m *Model) MoveDown(n int) {
// check if we're in the last set of rows before truncation would
// happen.
if m.cursor < len(m.rows)-m.height {
// TODO use maxOffset?
if m.cursor < m.maxYOffset() {
m.YOffset = m.YOffset + n
m.table.Offset(m.YOffset)
}