The open source coding agent.
TypeScript
fix(tui): markdown wrapping off sometimes
adamdottv269b43f4de80
diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.goindex fe34ad5ab97..4f3bfdfa2a5 100644--- a/packages/tui/internal/components/chat/message.go+++ b/packages/tui/internal/components/chat/message.go@@ -134,7 +134,6 @@ func renderContentBlock(style := styles.NewStyle().Foreground(renderer.textColor).Background(t.BackgroundPanel()).- Width(width).PaddingTop(renderer.paddingTop).PaddingBottom(renderer.paddingBottom).PaddingLeft(renderer.paddingLeft).@@ -232,16 +231,15 @@ func renderText(if highlight {backgroundColor = t.BackgroundElement()}- messageStyle := styles.NewStyle().Background(backgroundColor)- content := messageStyle.Render(text)-+ var content stringswitch casted := message.(type) {case opencode.AssistantMessage:ts = time.UnixMilli(int64(casted.Time.Created))content = util.ToMarkdown(text, width, backgroundColor)case opencode.UserMessage:ts = time.UnixMilli(int64(casted.Time.Created))- messageStyle = messageStyle.Width(width - 6)+ messageStyle := styles.NewStyle().Background(backgroundColor).Width(width - 6)+ content = messageStyle.Render(text)}timestamp := ts.@@ -307,8 +305,10 @@ func renderToolDetails(return ""}- if toolCall.State.Status == opencode.ToolPartStateStatusPending || toolCall.State.Status == opencode.ToolPartStateStatusRunning {+ if toolCall.State.Status == opencode.ToolPartStateStatusPending ||+ toolCall.State.Status == opencode.ToolPartStateStatusRunning {title := renderToolTitle(toolCall, width)+ title = styles.NewStyle().Width(width - 6).Render(title)return renderContentBlock(app, title, highlight, width)}@@ -457,6 +457,7 @@ func renderToolDetails(}body = *resultbody = util.TruncateHeight(body, 10)+ body = styles.NewStyle().Width(width - 6).Render(body)}}@@ -467,6 +468,7 @@ func renderToolDetails(if error != "" {body = styles.NewStyle().+ Width(width - 6).Foreground(t.Error()).Background(backgroundColor).Render(error)@@ -475,6 +477,7 @@ func renderToolDetails(if body == "" && error == "" && result != nil {body = *resultbody = util.TruncateHeight(body, 10)+ body = styles.NewStyle().Width(width - 6).Render(body)}title := renderToolTitle(toolCall, width)diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.goindex 6e9c26dfa45..573acdfcc63 100644--- a/packages/tui/internal/components/chat/messages.go+++ b/packages/tui/internal/components/chat/messages.go@@ -328,6 +328,7 @@ func (m *messagesComponent) renderView(width int) {}if error != "" {+ error = styles.NewStyle().Width(width - 6).Render(error)error = renderContentBlock(m.app,error,