MCPcopy Create free account
hub / github.com/codehamr/codehamr / flushStreaming

Method flushStreaming

internal/tui/render.go:69–82  ·  view source on GitHub ↗

flushStreaming ends the content phase: render the streaming buffer through glamour, queue it for tea.Println, reset. No-op on an empty buffer. Glamour errors fall back to raw so partial docs (unclosed code fence on cancel) survive.

()

Source from the content-addressed store, hash-verified

67}
68
69// flushStreaming ends the content phase: render the streaming buffer through
70// glamour, queue it for tea.Println, reset. No-op on an empty buffer. Glamour
71// errors fall back to raw so partial docs (unclosed code fence on cancel) survive.
72func (m *Model) flushStreaming() {
73 if m.streaming.Len() == 0 {
74 return
75 }
76 raw := m.streaming.String()
77 rendered, err := m.renderer.Render(raw)
78 if err != nil {
79 rendered = raw
80 }
81 // Strip glamour's trailing newline so tea.Println doesn't double-space
82 // the next prompt below the block.
83 m.appendLine(strings.TrimRight(rendered, "\n"))
84 m.streaming.Reset()
85}

Callers 3

applyToolCallMethod · 0.95
applyDoneMethod · 0.95
abortTurnMethod · 0.95

Calls 3

appendLineMethod · 0.95
StringMethod · 0.80
ResetMethod · 0.80

Tested by

no test coverage detected