Correct scroll percentage reporting

This commit is contained in:
Christian Rocha 2020-07-17 18:13:05 -04:00
parent 3c07b97d37
commit 5720cfb35a
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018

View File

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