@@ -259,25 +259,14 @@ func (l *List) ScrollBy(lines int) {
260 } else if lines < 0 {
260 } else if lines < 0 {
261 // Scroll up
261 // Scroll up
262− // Calculate from offset how many items needed to fill the viewport
262+ l.offsetLine += lines // lines is negative
263− // This is needed to know when to stop scrolling up
263+ for l.offsetLine < 0 {
265− var firstItemIdx int
266− for i := l.offsetIdx; i >= 0; i-- {
264+ if l.offsetIdx <= 0 {
267− item := l.getItem(i)
265+ // Reached top
268− totalLines += item.height
266+ l.ScrollToTop()
269− if l.gap > 0 && i < l.offsetIdx {
272− if totalLines >= l.height {
278− // Now scroll up by lines
279− l.offsetLine += lines // lines is negative
280− for l.offsetIdx > firstItemIdx && l.offsetLine < 0 {
281 // Move to previous item
270 // Move to previous item
282 l.offsetIdx--
271 l.offsetIdx--
283 prevItem := l.getItem(l.offsetIdx)
272 prevItem := l.getItem(l.offsetIdx)
@@ -287,10 +276,6 @@ func (l *List) ScrollBy(lines int) {
288 l.offsetLine += totalHeight
277 l.offsetLine += totalHeight
291− if l.offsetLine < 0 {