aboutsummaryrefslogtreecommitdiff
path: root/ui/messages/textbase.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui/messages/textbase.go')
-rw-r--r--ui/messages/textbase.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/ui/messages/textbase.go b/ui/messages/textbase.go
index 321d998..0d1cc3b 100644
--- a/ui/messages/textbase.go
+++ b/ui/messages/textbase.go
@@ -52,12 +52,12 @@ func matchBoundaryPattern(bare bool, extract tstring.TString) tstring.TString {
// CalculateBuffer generates the internal buffer for this message that consists
// of the text of this message split into lines at most as wide as the width
// parameter.
-func (msg *BaseMessage) calculateBufferWithText(prefs config.UserPreferences, text tstring.TString, width int) {
+func calculateBufferWithText(prefs config.UserPreferences, text tstring.TString, width int, msg *UIMessage) []tstring.TString {
if width < 2 {
- return
+ return nil
}
- msg.buffer = []tstring.TString{}
+ var buffer []tstring.TString
if prefs.BareMessageView {
newText := tstring.NewTString(msg.FormatTime())
@@ -74,7 +74,7 @@ func (msg *BaseMessage) calculateBufferWithText(prefs config.UserPreferences, te
newlines := 0
for _, str := range forcedLinebreaks {
if len(str) == 0 && newlines < 1 {
- msg.buffer = append(msg.buffer, tstring.TString{})
+ buffer = append(buffer, tstring.TString{})
newlines++
} else {
newlines = 0
@@ -88,8 +88,9 @@ func (msg *BaseMessage) calculateBufferWithText(prefs config.UserPreferences, te
}
extract = matchBoundaryPattern(prefs.BareMessageView, extract)
}
- msg.buffer = append(msg.buffer, extract)
+ buffer = append(buffer, extract)
str = str[len(extract):]
}
}
+ return buffer
}