From 82e1aa81dacbb5b8b9529e584eedd8feeae5c14e Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 14 May 2020 15:10:07 -0400 Subject: [PATCH] Fix percentage artithmetic in pager --- pager/pager.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pager/pager.go b/pager/pager.go index ded1431..3a43b46 100644 --- a/pager/pager.go +++ b/pager/pager.go @@ -25,7 +25,7 @@ func (m Model) ScrollPercent() float64 { y := float64(m.Y) h := float64(m.Height) t := float64(len(m.lines)) - return (y + h) / t + return y / (t - h) } // 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) lines := m.lines[top:bottom] - // Fill emtpy space with newlines + // Fill empty space with newlines extraLines := "" if len(lines) < m.Height { extraLines = strings.Repeat("\n", m.Height-len(lines))