ref: b75af1551d03e829569adcc202cfd68bc0244b2b
parent: fa6b8e9ed3fe6a4b4cc2efb0bf8552505cb2ffbb
author: penny <penny@limitedideas.org>
date: Sun Aug 3 19:27:13 EDT 2025
utf8 support in hyphenator, formatting for image descs
--- a/format.go
+++ b/format.go
@@ -10,7 +10,7 @@
width := readline.GetScreenWidth()
result, remainder := hyphenateline(input, width)
var cresult string
- for len(remainder) > width-1 {+ for len([]rune(remainder)) > width {cresult, remainder = hyphenateline(remainder, width)
result += cresult
}
@@ -26,12 +26,12 @@
begin, _, _ := strings.Cut(input, "\n")
hyphenate := false
- if len(begin) > width-1 {- begin = begin[:width-1]
+ if len([]rune(begin)) > width-1 {+ begin = string([]rune(begin)[:width-1])
hyphenate = true
}
- remainder := input[len(begin):]
+ remainder := string([]rune(input)[len([]rune(begin)):])
if hyphenate == true && begin[width-2] != ' ' {begin += "-"
--- a/mastodon.go
+++ b/mastodon.go
@@ -205,7 +205,7 @@
for _, item := range media { if item.Description != "" {- postfix += fmt.Sprintf("🖼️[%v]\n", item.Description)+ postfix += fmt.Sprintf("\n🖼️[%v]", item.Description)continue
}
postfix += "🖼️"
--
⑨