setConversationContent pushes the current scrollback buffer into the viewport, wrapping it to the viewport's width first so long lines (file output, JSON in errors, etc.) snap to the panel instead of trailing off the right edge. The wrap is ANSI-aware via lipgloss, so turn dividers, tool logs, and t
()
| 890 | // can collapse during its wrap pass. We pass the banner through unchanged |
| 891 | // and only wrap what comes after it. |
| 892 | func (m *harness) setConversationContent() { |
| 893 | w := m.viewport.Width |
| 894 | content := m.output.String() |
| 895 | if w <= 0 { |
| 896 | m.viewport.SetContent(content) |
| 897 | return |
| 898 | } |
| 899 | if m.bannerEnd > 0 && m.bannerEnd <= len(content) { |
| 900 | banner := content[:m.bannerEnd] |
| 901 | rest := content[m.bannerEnd:] |
| 902 | if rest != "" { |
| 903 | rest = lipgloss.NewStyle().Width(w).Render(rest) |
| 904 | } |
| 905 | m.viewport.SetContent(banner + rest) |
| 906 | return |
| 907 | } |
| 908 | m.viewport.SetContent(lipgloss.NewStyle().Width(w).Render(content)) |
| 909 | } |
| 910 | |
| 911 | // renderTurnHeader returns a "── 15:23:45 ─────────…" divider sized to |
| 912 | // width. Called when the user submits a new prompt so each turn has an |
no outgoing calls
no test coverage detected