diff options
Diffstat (limited to 'internal/ui/taskdetail.go')
| -rw-r--r-- | internal/ui/taskdetail.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/ui/taskdetail.go b/internal/ui/taskdetail.go index bcaed8f..d281341 100644 --- a/internal/ui/taskdetail.go +++ b/internal/ui/taskdetail.go @@ -4,6 +4,7 @@ import ( "fmt" "regexp" "strings" + "unicode/utf8" "charm.land/lipgloss/v2" @@ -26,7 +27,7 @@ func wordWrap(text string, width int) []string { for i := 1; i < len(words); i++ { word := words[i] testLine := currentLine + " " + word - if len(testLine) > width { + if runeLen(testLine) > width { lines = append(lines, currentLine) currentLine = word } else { @@ -40,6 +41,10 @@ func wordWrap(text string, width int) []string { return lines } +func runeLen(s string) int { + return utf8.RuneCountInString(s) +} + // Define field indices for navigation const ( fieldID = iota |
