on main help sign in
chore(spinner): set spinner to its original speed
commit9e82d063298ab744c87b1935effa485a7addae44 authorChristian Rocha <christian@rocha.is> dateWed 25 Jun 2025, 08:30 (1 year ago) parentd575f93
1 file changed+10−10
internal/tui/components/anim/anim.go+10−10
internal/tui/components/anim/anim.go+10−10
@@ -17,9 +17,9 @@ import (
1717)
1818
1919const (
20− charCyclingFPS = time.Second / 8 // 8 FPS for better CPU efficiency
21− colorCycleFPS = time.Second / 3 // 3 FPS
22− maxCyclingChars = 60 // 60 characters
20+ charCyclingFPS = time.Second / 22
21+ colorCycleFPS = time.Second / 5
22+ maxCyclingChars = 60
2323)
2424
2525var (
@@ -29,7 +29,7 @@ var (
2929)
3030
3131func init() {
32− // Pre-populate the character pool to avoid runtime random generation
32+ // Pre-populate the character pool to avoid runtime random generation.
3333 for i := range charRunePool {
3434 charRunePool[i] = charRunes[rand.IntN(len(charRunes))]
3535 }
@@ -52,7 +52,7 @@ type cyclingChar struct {
5252}
5353
5454func (c cyclingChar) randomRune() rune {
55− // Use pre-generated pool instead of runtime random generation
55+ // Use pre-generated pool instead of runtime random generation.
5656 poolIndex = (poolIndex + 1) % len(charRunePool)
5757 return charRunePool[poolIndex]
5858}
@@ -139,13 +139,13 @@ func New(cyclingCharsSize uint, label string, opts ...animOption) Animation {
139139 // color the cycling characters with a gradient ramp.
140140 const minRampSize = 3
141141 if n >= minRampSize {
142− // Optimized: single capacity allocation for color cycling
142+ // Optimized: single capacity allocation for color cycling.
143143 c.ramp = make([]lipgloss.Style, 0, n*2)
144144 ramp := makeGradientRamp(n)
145145 for _, color := range ramp {
146146 c.ramp = append(c.ramp, lipgloss.NewStyle().Foreground(color))
147147 }
148− // Create reversed copy for seamless color cycling
148+ // Create reversed copy for seamless color cycling.
149149 reversed := make([]lipgloss.Style, len(c.ramp))
150150 for i, style := range c.ramp {
151151 reversed[len(c.ramp)-1-i] = style
@@ -263,7 +263,7 @@ func (a anim) View() tea.View {
263263 b strings.Builder
264264 )
265265
266− // Optimized capacity calculation to reduce allocations
266+ // Optimized capacity calculation to reduce allocations.
267267 const (
268268 bytesPerChar = 15 // Reduced estimate for ANSI styling
269269 bufferSize = 30 // Reduced safety margin
@@ -271,7 +271,7 @@ func (a anim) View() tea.View {
271271 estimatedCap := len(a.cyclingChars)*bytesPerChar + len(a.labelChars)*bytesPerChar + bufferSize
272272 b.Grow(estimatedCap)
273273
274− // Render cycling characters with gradient (if available)
274+ // Render cycling characters with gradient (if available).
275275 for i, c := range a.cyclingChars {
276276 if len(a.ramp) > i {
277277 b.WriteString(a.ramp[i].Render(string(c.currentValue)))
@@ -280,7 +280,7 @@ func (a anim) View() tea.View {
280280 }
281281 }
282282
283− // Render label characters and ellipsis
283+ // Render label characters and ellipsis.
284284 if len(a.labelChars) > 1 {
285285 textStyle := t.S().Text
286286 for _, c := range a.labelChars {