From a8109c55df6fc28d46a38278d4123de8bce9a048 Mon Sep 17 00:00:00 2001 From: Caleb Bassi Date: Fri, 1 Mar 2019 13:28:09 -0800 Subject: [PATCH] Fix list scrolling (Fix #228) --- widgets/list.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/widgets/list.go b/widgets/list.go index 1778b26..3e2f268 100644 --- a/widgets/list.go +++ b/widgets/list.go @@ -35,8 +35,9 @@ func (self *List) Draw(buf *Buffer) { point := self.Inner.Min - if self.SelectedRow >= self.Inner.Max.Y+self.topRow-2 { - self.topRow = self.SelectedRow - self.Inner.Max.Y + 2 + // adjusts view into widget + if self.SelectedRow >= self.Inner.Dy()+self.topRow { + self.topRow = self.SelectedRow - self.Inner.Dy() + 1 } else if self.SelectedRow < self.topRow { self.topRow = self.SelectedRow }