MCPcopy Index your code
hub / github.com/docker/docker-agent / RemoveLast

Method RemoveLast

pkg/tui/components/transcript/transcript.go:179–186  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

177// stopping its animation subscription (mirrors the message list's
178// RemoveSpinner contract: leaked subscriptions keep the tick stream alive).
179func (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.
189func (t *Transcript) Update(msg tea.Msg) tea.Cmd {

Callers 3

AppendToLastMessageMethod · 0.95
AddOrUpdateToolCallMethod · 0.95
TestRemoveLastFunction · 0.80

Calls 1

StopViewFunction · 0.92

Tested by 1

TestRemoveLastFunction · 0.64