mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-20 23:24:18 +02:00
Remove some magic numbers to calm the linter down
This commit is contained in:
parent
ae0c747a4b
commit
6aba7afb8b
1 changed files with 7 additions and 2 deletions
|
|
@ -360,6 +360,11 @@ func pagerView(m pagerModel) string {
|
|||
}
|
||||
|
||||
func pagerStatusBarView(b *strings.Builder, m pagerModel) {
|
||||
const (
|
||||
minPercent float64 = 0.0
|
||||
maxPercent float64 = 1.0
|
||||
percentToStringMagnitude float64 = 100.0
|
||||
)
|
||||
var (
|
||||
isStashed bool = m.currentDocument.markdownType == stashedMarkdown || m.currentDocument.markdownType == convertedMarkdown
|
||||
showStatusMessage bool = m.state == pagerStateStatusMessage
|
||||
|
|
@ -369,8 +374,8 @@ func pagerStatusBarView(b *strings.Builder, m pagerModel) {
|
|||
logo := glowLogoView(" Glow ")
|
||||
|
||||
// Scroll percent
|
||||
percent := math.Max(0.0, math.Min(1.0, m.viewport.ScrollPercent()))
|
||||
scrollPercent := fmt.Sprintf(" %3.f%% ", percent*100)
|
||||
percent := math.Max(minPercent, math.Min(maxPercent, m.viewport.ScrollPercent()))
|
||||
scrollPercent := fmt.Sprintf(" %3.f%% ", percent*percentToStringMagnitude)
|
||||
if showStatusMessage {
|
||||
scrollPercent = statusBarMessageScrollPosStyle(scrollPercent)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue