diff --git a/CHANGELOG b/CHANGELOG index 16e7e4d..1d1dc0a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ v1.4.7 (WIP) - Add List.SetSelectedAlwaysCentered - Fix default background transparency of Flex and Grid - Fix ANSI colors 0-15 +- Fix negative List offset and DropDown selection v1.4.6 (2020-05-18) - Add Box.ShowFocus diff --git a/list.go b/list.go index ae9319c..6cba756 100644 --- a/list.go +++ b/list.go @@ -217,6 +217,10 @@ func (l *List) SetOffset(offset int) *List { l.Lock() defer l.Unlock() + if offset < 0 { + offset = 0 + } + l.offset = offset return l } @@ -690,6 +694,10 @@ func (l *List) updateOffset() { l.offset = len(l.items) - l.height } } + + if l.offset < 0 { + l.offset = 0 + } } // Draw draws this primitive onto the screen.