M gemini/gemtext.go => gemini/gemtext.go +1 -1
@@ 64,7 64,7 @@ func ToANSI(data string, availableWidth int, baseURL neturl.URL) (
continue
}
- w := text.TextWrap(line, TextWidth)
+ w := text.Wrap(line, TextWidth)
fmt.Fprint(&s, w)
ypos += strings.Count(w, "\n")
}
M gopher/gopher.go => gopher/gopher.go +1 -1
@@ 24,7 24,7 @@ func ToANSI(data []byte, typ byte) (s string, links text.Links) {
var buf strings.Builder
switch typ {
case '0', 'h':
- return text.TextWrap(string(data), TextWidth), links
+ return text.Wrap(string(data), TextWidth), links
}
var ypos int
for _, line := range strings.Split(string(data), "\n") {
M message.go => message.go +1 -1
@@ 27,7 27,7 @@ func (m Message) Update(msg tea.Msg) (Message, tea.Cmd) {
}
func (m Message) View() string {
- msg := text.TextWrap(m.Message, 80)
+ msg := text.Wrap(m.Message, 80)
if m.WithConfirm {
return fmt.Sprintf("%s\n\n(Y)es or (N)o", msg)
}
M text/wordwrap.go => text/wordwrap.go +2 -2
@@ 8,10 8,10 @@ import (
const softHyphen = '\u00AD'
-// TextWrap wraps text so that each line is no longer than maxlen by inserting newlines.
+// Wrap wraps text so that each line is no longer than maxlen by inserting newlines.
// Spaces and '-' will be used as natural breaking points, but if individual words are longer
// than maxlen a newline will be inserted to break them up.
-func TextWrap(text string, maxlen int) string {
+func Wrap(text string, maxlen int) string {
var buf bytes.Buffer
for _, line := range strings.Split(text, "\n") {
fmt.Fprintln(&buf, lineWrap(line, maxlen))