forked from Mirrors/bubbletea
Fix percentage artithmetic in pager
This commit is contained in:
parent
3960657824
commit
82e1aa81da
|
@ -25,7 +25,7 @@ func (m Model) ScrollPercent() float64 {
|
||||||
y := float64(m.Y)
|
y := float64(m.Y)
|
||||||
h := float64(m.Height)
|
h := float64(m.Height)
|
||||||
t := float64(len(m.lines))
|
t := float64(len(m.lines))
|
||||||
return (y + h) / t
|
return y / (t - h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Content set the pager's text content
|
// Content set the pager's text content
|
||||||
|
@ -128,7 +128,7 @@ func View(model boba.Model) string {
|
||||||
bottom := min(len(m.lines), m.Y+m.Height)
|
bottom := min(len(m.lines), m.Y+m.Height)
|
||||||
lines := m.lines[top:bottom]
|
lines := m.lines[top:bottom]
|
||||||
|
|
||||||
// Fill emtpy space with newlines
|
// Fill empty space with newlines
|
||||||
extraLines := ""
|
extraLines := ""
|
||||||
if len(lines) < m.Height {
|
if len(lines) < m.Height {
|
||||||
extraLines = strings.Repeat("\n", m.Height-len(lines))
|
extraLines = strings.Repeat("\n", m.Height-len(lines))
|
||||||
|
|
Loading…
Reference in New Issue