diff options
| author | Aiden Cline <[email protected]> | 2025-07-19 12:36:50 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-19 12:36:50 -0500 |
| commit | 9c5d9be33a56e99c18726f579cd61d535eb0df13 (patch) | |
| tree | 5c204d6647a5d0b49353926ecafd40bd5d75ef7e | |
| parent | 97d9c851e6725833f8edcec1e606a281609dbd74 (diff) | |
| download | opencode-9c5d9be33a56e99c18726f579cd61d535eb0df13.tar.gz opencode-9c5d9be33a56e99c18726f579cd61d535eb0df13.zip | |
fix: bullet display (#1148)
| -rw-r--r-- | packages/tui/internal/util/text.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/tui/internal/util/text.go b/packages/tui/internal/util/text.go index 6a1e81bb8..8ac98ebc5 100644 --- a/packages/tui/internal/util/text.go +++ b/packages/tui/internal/util/text.go @@ -1,6 +1,7 @@ package util import ( + "regexp" "strings" "github.com/charmbracelet/lipgloss/v2" @@ -9,8 +10,12 @@ import ( // PreventHyphenBreaks replaces regular hyphens with non-breaking hyphens to prevent // sparse word breaks in hyphenated terms like "claude-code-action". // This improves readability by keeping hyphenated words together. +// Only preserves hyphens within words, not markdown syntax like bullet points. func PreventHyphenBreaks(text string) string { - return strings.ReplaceAll(text, "-", "\u2011") + // Use regex to match hyphens that are between word characters + // This preserves hyphens in words like "claude-code-action" but not in "- [ ]" + re := regexp.MustCompile(`(\w)-(\w)`) + return re.ReplaceAllString(text, "$1\u2011$2") } // RestoreHyphens converts non-breaking hyphens back to regular hyphens. |
