fix(tui): less incorrect escapingn of < and >

This commit is contained in:
adamdottv 2025-06-23 11:32:32 -05:00
parent 966015c9ae
commit 5e79e3d7a5
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75

View file

@ -25,8 +25,6 @@ import (
func toMarkdown(content string, width int, backgroundColor compat.AdaptiveColor) string {
r := styles.GetMarkdownRenderer(width, backgroundColor)
content = strings.ReplaceAll(content, app.RootPath+"/", "")
content = strings.ReplaceAll(content, "<", "\\<")
content = strings.ReplaceAll(content, ">", "\\>")
rendered, _ := r.Render(content)
lines := strings.Split(rendered, "\n")
@ -230,6 +228,10 @@ func renderText(message client.MessageInfo, text string, author string) string {
if message.Role == client.Assistant {
markdownWidth = width - padding - 4 - 2
}
if message.Role == client.User {
text = strings.ReplaceAll(text, "<", "\\<")
text = strings.ReplaceAll(text, ">", "\\>")
}
content := toMarkdown(text, markdownWidth, t.BackgroundPanel())
content = strings.Join([]string{content, info}, "\n")