Merge branch 'master' into beta

This commit is contained in:
Ayman Bagabas
2024-06-05 11:53:51 -04:00
12 changed files with 591 additions and 226 deletions
+3 -3
View File
@@ -10,8 +10,8 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/harmonica"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/x/ansi"
"github.com/lucasb-eyer/go-colorful"
"github.com/muesli/reflow/ansi"
)
// Internal ID management. Used during animating to assure that frame messages
@@ -271,7 +271,7 @@ func (m Model) View(ctx tea.Context) string {
func (m Model) ViewAs(ctx tea.Context, percent float64) string {
b := strings.Builder{}
percentView := m.percentageView(percent)
m.barView(ctx, &b, percent, ansi.PrintableRuneWidth(percentView))
m.barView(ctx, &b, percent, ansi.StringWidth(percentView))
b.WriteString(percentView)
return b.String()
}
@@ -297,7 +297,7 @@ func (m Model) barView(ctx tea.Context, b *strings.Builder, percent float64, tex
if fw == 1 {
// this is up for debate: in a gradient of width=1, should the
// single character rendered be the first color, the last color
// or exactly 50% inbetween? I opted for 50%
// or exactly 50% in between? I opted for 50%
p = 0.5
} else if m.scaleRamp {
p = float64(i) / float64(fw-1)