From a55ea42d7f5900bd5fc8fad047040c7865824f33 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 15 Jun 2019 01:11:51 +0300 Subject: Unbreak things --- ui/messages/textbase.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ui/messages/textbase.go') 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 } -- cgit v1.2.3