mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-03 06:50:26 +00:00
fix: prevent sparse spacing in hyphenated words (#1102)
This commit is contained in:
parent
4bbbbac5f6
commit
2b44dbdbf1
4 changed files with 70 additions and 7 deletions
|
|
@ -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 ""
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue