From e5198dec0e95da652131215c38e0dd29ac8f3294 Mon Sep 17 00:00:00 2001 From: Charalampos Mitsakis Date: Fri, 26 May 2023 22:16:21 +0000 Subject: [PATCH] fix: Table offset should not be negative (#3049) fixes #2857 --- widget/table.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/widget/table.go b/widget/table.go index dde9efc512..3453062e60 100644 --- a/widget/table.go +++ b/widget/table.go @@ -222,6 +222,9 @@ func (t *Table) ScrollToBottom() { rows, _ := t.Length() cellY, cellHeight := t.findY(rows - 1) y := cellY + cellHeight - t.scroll.Size().Height + if y <= 0 { + return + } t.scroll.Offset.Y = y t.offset.Y = y @@ -265,6 +268,9 @@ func (t *Table) ScrollToTrailing() { _, cols := t.Length() cellX, cellWidth := t.findX(cols - 1) scrollX := cellX + cellWidth - t.scroll.Size().Width + if scrollX <= 0 { + return + } t.scroll.Offset.X = scrollX t.offset.X = scrollX