Skip to content

Commit

Permalink
Fix division by zero in viewport scrollpercentage calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
zMoooooritz authored and meowgorithm committed Mar 11, 2024
1 parent b9e62cb commit 961c081
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion viewport/viewport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit 961c081

Please sign in to comment.