Merge pull request #217 from NovA9232/master

List scrolls automatically.
This commit is contained in:
Caleb Bassi 2019-01-31 05:53:10 -08:00 committed by GitHub
commit cdc401406b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,12 @@ func (self *List) Draw(buf *Buffer) {
point := self.Inner.Min point := self.Inner.Min
if self.SelectedRow >= uint(self.Inner.Max.Y)+self.topRow-2 {
self.topRow = self.SelectedRow-uint(self.Inner.Max.Y)+2
} else if self.SelectedRow < self.topRow {
self.topRow = self.SelectedRow
}
for row := self.topRow; row < uint(len(self.Rows)) && point.Y < self.Inner.Max.Y; row++ { for row := self.topRow; row < uint(len(self.Rows)) && point.Y < self.Inner.Max.Y; row++ {
cells := ParseText(self.Rows[row], self.TextStyle) cells := ParseText(self.Rows[row], self.TextStyle)
if self.WrapText { if self.WrapText {