summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/components
diff options
context:
space:
mode:
Diffstat (limited to 'packages/tui/internal/components')
-rw-r--r--packages/tui/internal/components/chat/message.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.go
index ab4e7d014..db8a43268 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.