Correct scroll percentage reporting

This commit is contained in:
Christian Rocha
2020-07-17 18:13:05 -04:00
parent 3c07b97d37
commit 5720cfb35a

View File

@@ -65,7 +65,7 @@ func (m Model) ScrollPercent() float64 {
} }
y := float64(m.YOffset) y := float64(m.YOffset)
h := float64(m.Height) h := float64(m.Height)
t := float64(len(m.lines)) t := float64(len(m.lines) - 1)
v := y / (t - h) v := y / (t - h)
return math.Max(0.0, math.Min(1.0, v)) return math.Max(0.0, math.Min(1.0, v))
} }