The open source coding agent.
TypeScript
fix(tui): render attachments in user messages in accent color
adamdotdevina39136a2a0af
diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.goindex ab4e7d01457..db8a43268f7 100644--- a/packages/tui/internal/components/chat/message.go+++ b/packages/tui/internal/components/chat/message.go@@ -9,6 +9,7 @@ import ("github.com/charmbracelet/lipgloss/v2""github.com/charmbracelet/lipgloss/v2/compat"+ "github.com/charmbracelet/x/ansi""github.com/sst/opencode-sdk-go""github.com/sst/opencode/internal/app""github.com/sst/opencode/internal/components/diff"@@ -193,8 +194,18 @@ func renderText(content = util.ToMarkdown(text, width, backgroundColor)case opencode.UserMessage:ts = time.UnixMilli(int64(casted.Time.Created))- messageStyle := styles.NewStyle().Background(backgroundColor).Width(width - 6)- content = messageStyle.Render(text)+ base := styles.NewStyle().Foreground(t.Text()).Background(backgroundColor)+ words := strings.Fields(text)+ for i, word := range words {+ if strings.HasPrefix(word, "@") {+ words[i] = base.Foreground(t.Secondary()).Render(word + " ")+ } else {+ words[i] = base.Render(word + " ")+ }+ }+ text = strings.Join(words, "")+ text = ansi.WordwrapWc(text, width-6, " -")+ content = base.Width(width - 6).Render(text)}timestamp := ts.diff --git a/packages/tui/internal/tui/tui.go b/packages/tui/internal/tui/tui.goindex de1c6df2dd8..3227b49506a 100644--- a/packages/tui/internal/tui/tui.go+++ b/packages/tui/internal/tui/tui.go@@ -1117,7 +1117,9 @@ func formatConversationToMarkdown(messages []app.Message) string {continue}- builder.WriteString(fmt.Sprintf("**%s** (*%s*)\n\n", role, timestamp.Format("2006-01-02 15:04:05")))+ builder.WriteString(+ fmt.Sprintf("**%s** (*%s*)\n\n", role, timestamp.Format("2006-01-02 15:04:05")),+ )for _, part := range msg.Parts {switch p := part.(type) {