Fix division by zero in viewport scrollpercentage calculation

This commit is contained in:
Moritz Biering
2024-03-11 09:32:23 -04:00
committed by Christian Rocha
parent b9e62cbfe1
commit 961c081347
+1 -1
View File
@@ -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))
}