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.
()
| 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. |
| 72 | func (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 | } |
no test coverage detected