mirror of
https://github.com/sst/opencode.git
synced 2025-08-04 13:30:52 +00:00
fix(tui): less incorrect escapingn of < and >
This commit is contained in:
parent
966015c9ae
commit
5e79e3d7a5
1 changed files with 4 additions and 2 deletions
|
@ -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")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue