aboutsummaryrefslogtreecommitdiff
path: root/ui/messages/textbase.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2019-06-15 01:11:51 +0300
committerTulir Asokan <tulir@maunium.net>2019-06-15 01:11:54 +0300
commita55ea42d7f5900bd5fc8fad047040c7865824f33 (patch)
tree2b5ee3f3087751471903a21e99ca7a68fc97b928 /ui/messages/textbase.go
parenta4ac699c930e783175b6451a5becd7b70835aefb (diff)
Unbreak things
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
}