From 3ab3b8fcb4a8f96f546bdba8af35cacb428ccb60 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Mon, 18 May 2020 20:19:15 -0400 Subject: [PATCH] Also keep the scroll percentage at 0% or higher --- ui/ui.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ui/ui.go b/ui/ui.go index 89869a0..3f33b7e 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -3,6 +3,7 @@ package ui import ( "errors" "fmt" + "math" "os" "strings" @@ -310,12 +311,7 @@ func statusBarView(m model) string { logo := glowLogoView(logoText) // Scroll percent - scrollPercent := m.pager.ScrollPercent() - if scrollPercent > 1.0 { - // Don't let read more than 100%, which could happen if we resize and - // the bottom of the page ends up in the middle of the window. - scrollPercent = 1.0 - } + scrollPercent := math.Max(0.0, math.Min(1.0, m.pager.ScrollPercent())) percentText := fmt.Sprintf(" %3.f%% ", scrollPercent*100) percent := te.String(percentText). Foreground(statusBarFg.Color()).