Rebuild recreates every view from its message, dropping all cached rendered output. Use it on theme change: the views memoize rendered ANSI, so a style swap must start from scratch. Returns the new views' Init commands (re-arming spinner animations).
()
| 244 | // ANSI, so a style swap must start from scratch. Returns the new views' |
| 245 | // Init commands (re-arming spinner animations). |
| 246 | func (t *Transcript) Rebuild() tea.Cmd { |
| 247 | t.StopAnimations() |
| 248 | var cmds []tea.Cmd |
| 249 | var prev *types.Message |
| 250 | for i, msg := range t.msgs { |
| 251 | v := t.newView(msg, prev) |
| 252 | t.views[i] = v |
| 253 | if cmd := v.Init(); cmd != nil { |
| 254 | cmds = append(cmds, cmd) |
| 255 | } |
| 256 | prev = msg |
| 257 | } |
| 258 | return tea.Batch(cmds...) |
| 259 | } |
| 260 | |
| 261 | // StopAnimations unregisters every view from the animation coordinator. |
| 262 | // Call it when the host view goes away (e.g. the embedding dialog closes) |