Fix negative List offset and DropDown selection

Resolves #16.
This commit is contained in:
Trevor Slocum 2020-06-02 15:51:03 -07:00
parent 4411a746d8
commit 81cfea205d
2 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -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.