mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 17:54:23 +01:00
fix: word wrapping with hyphens
This commit is contained in:
@@ -325,7 +325,9 @@ func renderText(
|
|||||||
|
|
||||||
// wrap styled text
|
// wrap styled text
|
||||||
styledText := result.String()
|
styledText := result.String()
|
||||||
wrappedText := ansi.WordwrapWc(styledText, width-6, " -")
|
styledText = strings.ReplaceAll(styledText, "-", "\u2011")
|
||||||
|
wrappedText := ansi.WordwrapWc(styledText, width-6, " ")
|
||||||
|
wrappedText = strings.ReplaceAll(wrappedText, "\u2011", "-")
|
||||||
content = base.Width(width - 6).Render(wrappedText)
|
content = base.Width(width - 6).Render(wrappedText)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ func Extension(path string) string {
|
|||||||
func ToMarkdown(content string, width int, backgroundColor compat.AdaptiveColor) string {
|
func ToMarkdown(content string, width int, backgroundColor compat.AdaptiveColor) string {
|
||||||
r := styles.GetMarkdownRenderer(width-6, backgroundColor)
|
r := styles.GetMarkdownRenderer(width-6, backgroundColor)
|
||||||
content = strings.ReplaceAll(content, RootPath+"/", "")
|
content = strings.ReplaceAll(content, RootPath+"/", "")
|
||||||
|
content = strings.ReplaceAll(content, "-", "\u2011")
|
||||||
rendered, _ := r.Render(content)
|
rendered, _ := r.Render(content)
|
||||||
lines := strings.Split(rendered, "\n")
|
lines := strings.Split(rendered, "\n")
|
||||||
|
|
||||||
@@ -105,5 +106,6 @@ func ToMarkdown(content string, width int, backgroundColor compat.AdaptiveColor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
content = strings.Join(lines, "\n")
|
content = strings.Join(lines, "\n")
|
||||||
|
content = strings.ReplaceAll(content, "\u2011", "-")
|
||||||
return strings.TrimSuffix(content, "\n")
|
return strings.TrimSuffix(content, "\n")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user