mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
Merge branch 'master' into beta
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user