RemoveLast drops the most recent message when it has the given type, stopping its animation subscription (mirrors the message list's RemoveSpinner contract: leaked subscriptions keep the tick stream alive).
(typ types.MessageType)
| 177 | // stopping its animation subscription (mirrors the message list's |
| 178 | // RemoveSpinner contract: leaked subscriptions keep the tick stream alive). |
| 179 | func (t *Transcript) RemoveLast(typ types.MessageType) { |
| 180 | n := len(t.msgs) |
| 181 | if n == 0 || t.msgs[n-1].Type != typ { |
| 182 | return |
| 183 | } |
| 184 | animation.StopView(t.views[n-1]) |
| 185 | t.msgs, t.views = t.msgs[:n-1], t.views[:n-1] |
| 186 | } |
| 187 | |
| 188 | // Update forwards a message (animation ticks) to all views. |
| 189 | func (t *Transcript) Update(msg tea.Msg) tea.Cmd { |