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.go14
-rw-r--r--packages/tui/internal/components/textarea/textarea.go4
2 files changed, 14 insertions, 4 deletions
diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.go
index d3263b053..ef097c09c 100644
--- a/packages/tui/internal/components/chat/message.go
+++ b/packages/tui/internal/components/chat/message.go
@@ -196,6 +196,8 @@ func renderText(
case opencode.UserMessage:
ts = time.UnixMilli(int64(casted.Time.Created))
base := styles.NewStyle().Foreground(t.Text()).Background(backgroundColor)
+
+ // Process @ mentions and styling with hyphen preservation
words := strings.Fields(text)
for i, word := range words {
if strings.HasPrefix(word, "@") {
@@ -204,9 +206,14 @@ func renderText(
words[i] = base.Render(word + " ")
}
}
- text = strings.Join(words, "")
- text = ansi.WordwrapWc(text, width-6, " -")
- content = base.Width(width - 6).Render(text)
+ styledText := strings.Join(words, "")
+
+ // Apply word wrapping with hyphen preservation
+ frameSize := util.GetMessageContainerFrame()
+ wrappedText := util.ProcessTextWithHyphens(styledText, func(t string) string {
+ return ansi.WordwrapWc(t, width-frameSize, " ")
+ })
+ content = base.Width(width - frameSize).Render(wrappedText)
}
timestamp := ts.
@@ -707,5 +714,4 @@ func renderDiagnostics(
// if !ok {
// return ""
// }
-
}
diff --git a/packages/tui/internal/components/textarea/textarea.go b/packages/tui/internal/components/textarea/textarea.go
index cc073e27d..a4b954d49 100644
--- a/packages/tui/internal/components/textarea/textarea.go
+++ b/packages/tui/internal/components/textarea/textarea.go
@@ -2051,6 +2051,10 @@ func wrapInterfaces(content []any, width int) [][]any {
if unicode.IsSpace(r) {
isSpace = true
}
+ // Use hyphen-aware word boundary detection
+ if r == '-' {
+ isSpace = false
+ }
itemW = rw.RuneWidth(r)
} else if att, ok := item.(*Attachment); ok {
itemW = uniseg.StringWidth(att.Display)