@@ -83,14 +83,24 @@ func New(numChars int, label string, t *styles.Theme) (a Anim) {
8383 a.width += labelGapWidth + lipgloss.Width(label)
8484 }
8585
86− // Pre-render the label.
87− // XXX: We should really get the graphemes for the label, not the runes.
88− labelRunes := []rune(label)
89− a.label = make([]string, len(labelRunes))
90− for i := range a.label {
91− a.label[i] = lipgloss.NewStyle().
92− Foreground(t.FgBase).
93− Render(string(labelRunes[i]))
86+ if a.labelWidth > 0 {
87+ // Pre-render the label.
88+ // XXX: We should really get the graphemes for the label, not the runes.
89+ labelRunes := []rune(label)
90+ a.label = make([]string, len(labelRunes))
91+ for i := range a.label {
92+ a.label[i] = lipgloss.NewStyle().
93+ Foreground(t.FgBase).
94+ Render(string(labelRunes[i]))
95+ }
96+
97+ // Pre-render the ellipsis frames which come after the label.
98+ a.ellipsisFrames = make([]string, len(ellipsisFrames))
99+ for i, frame := range ellipsisFrames {
100+ a.ellipsisFrames[i] = lipgloss.NewStyle().
101+ Foreground(t.FgBase).
102+ Render(frame)
103+ }
94104 }
95105
96106 // Pre-generate gradient.
@@ -104,14 +114,6 @@ func New(numChars int, label string, t *styles.Theme) (a Anim) {
104114 Render(string(initialChar))
105115 }
106116
107− // Pre-render the ellipsis frames.
108− a.ellipsisFrames = make([]string, len(ellipsisFrames))
109− for i, frame := range ellipsisFrames {
110− a.ellipsisFrames[i] = lipgloss.NewStyle().
111− Foreground(t.FgBase).
112− Render(frame)
113− }
114−
115117 // Prerender scrambled rune frames for the animation.
116118 a.cyclingFrames = make([][]string, prerenderedFrames)
117119 for i := range a.cyclingFrames {
@@ -154,7 +156,7 @@ func (a Anim) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
154156 a.step = 0
155157 }
156158
157− if a.initialized {
159+ if a.initialized && a.labelWidth > 0 {
158160 // Manage the ellipsis animation.
159161 a.ellipsisStep++
160162 if a.ellipsisStep >= ellipsisAnimSpeed*len(ellipsisFrames) {
@@ -190,7 +192,7 @@ func (a Anim) View() tea.View {
190192 }
191193 // Render animated ellipsis at the end of the label if all characters
192194 // have been initialized.
193− if a.initialized {
195+ if a.initialized && a.labelWidth > 0 {
194196 b.WriteString(a.ellipsisFrames[a.ellipsisStep/ellipsisAnimSpeed])
195197 }
196198 return tea.NewView(b.String())