mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-23 16:44:17 +02:00
Bugfix: scroll percentage could read higher than 100% ater a resize
This commit is contained in:
parent
d299ee3365
commit
f43a0271d2
1 changed files with 7 additions and 1 deletions
8
ui/ui.go
8
ui/ui.go
|
|
@ -310,7 +310,13 @@ func statusBarView(m model) string {
|
|||
logo := glowLogoView(logoText)
|
||||
|
||||
// Scroll percent
|
||||
percentText := fmt.Sprintf(" %3.f%% ", m.pager.ScrollPercent()*100)
|
||||
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
|
||||
}
|
||||
percentText := fmt.Sprintf(" %3.f%% ", scrollPercent*100)
|
||||
percent := te.String(percentText).
|
||||
Foreground(statusBarFg.Color()).
|
||||
Background(statusBarBg.Color()).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue