mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
Fix division by zero in viewport scrollpercentage calculation
This commit is contained in:
committed by
Christian Rocha
parent
b9e62cbfe1
commit
961c081347
@@ -92,7 +92,7 @@ func (m Model) ScrollPercent() float64 {
|
||||
}
|
||||
y := float64(m.YOffset)
|
||||
h := float64(m.Height)
|
||||
t := float64(len(m.lines) - 1)
|
||||
t := float64(len(m.lines))
|
||||
v := y / (t - h)
|
||||
return math.Max(0.0, math.Min(1.0, v))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user