From 335f57fbc8403b32b5e3d8ea1cb1b713cdacb5fc Mon Sep 17 00:00:00 2001 From: citrons Date: Sun, 1 Jun 2025 19:10:35 -0500 Subject: message history --- tui/layout.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'tui/layout.go') diff --git a/tui/layout.go b/tui/layout.go index 5811f4e..480f3cc 100644 --- a/tui/layout.go +++ b/tui/layout.go @@ -285,9 +285,10 @@ func (b *Box) computePositions(axis int) { if last != nil { lastPos := last.computedPosition - lastPos += last.computedSize[axis] if b.Dir.reverse() { lastPos = b.computedSize[axis] - lastPos + } else { + lastPos += last.computedSize[axis] } b.Scroll.absolute = min(b.Scroll.absolute, lastPos - b.computedSize[axis]) } @@ -300,7 +301,7 @@ func (b *Box) computePositions(axis int) { } else { c.computedPosition += b.Scroll.absolute } - if c.computedPosition > b.computedRect.min[axis] && + if c.computedPosition >= b.computedRect.min[axis] && c.computedPosition < b.computedRect.max[axis] { if firstShown == nil { firstShown = c @@ -308,12 +309,9 @@ func (b *Box) computePositions(axis int) { lastShown = c } } - if firstShown == first { - b.Scroll.atFirst = true - } - if lastShown == last { - b.Scroll.atLast = true - } + b.Scroll.atFirst = firstShown == first + b.Scroll.atLast = lastShown == last + if firstShown != nil { p := first.computedPosition if b.Dir.reverse() { -- cgit v1.2.3