fix(ui): wrap assistant messages to terminal width

- ToMarkdown() received a width param but never used it
- Apply lipgloss.Wrap() after herald-md render to break long lines
- Preserves ANSI styles/colors through the wrapping pass
- Fixes overflow for all markdown paths: assistant messages, tool
  bodies, and overlay text
This commit is contained in:
Ed Zynda
2026-04-08 13:34:33 +03:00
parent 5ff28445fd
commit e33564c569
+5 -3
View File
@@ -85,11 +85,13 @@ func GetMarkdownTypography() *herald.Typography {
return ty
}
// ToMarkdown renders markdown content using herald-md.
// The width parameter is currently unused as herald handles wrapping
// based on terminal width internally.
// ToMarkdown renders markdown content using herald-md and wraps the result
// to the given width so that long lines do not overflow the terminal.
func ToMarkdown(content string, width int) string {
ty := GetMarkdownTypography()
rendered := heraldmd.Render(ty, []byte(content))
if width > 0 {
rendered = lipgloss.Wrap(rendered, width, "")
}
return rendered
}