We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eaff7e7 commit 5e1cef4Copy full SHA for 5e1cef4
viewport/viewport.go
@@ -87,12 +87,14 @@ func (m Model) PastBottom() bool {
87
88
// ScrollPercent returns the amount scrolled as a float between 0 and 1.
89
func (m Model) ScrollPercent() float64 {
90
- if m.Height >= len(m.lines) {
+ actualDisplayedLength := len(linesToActualDisplayedLines(m.lines, m.Width))
91
+
92
+ if m.Height >= actualDisplayedLength {
93
return 1.0
94
}
95
y := float64(m.YOffset)
96
h := float64(m.Height)
- t := float64(len(m.lines))
97
+ t := float64(actualDisplayedLength)
98
v := y / (t - h)
99
return math.Max(0.0, math.Min(1.0, v))
100
0 commit comments