aboutsummaryrefslogtreecommitdiff
path: root/ui/messages
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2019-06-16 14:29:03 +0300
committerTulir Asokan <tulir@maunium.net>2019-06-16 14:54:12 +0300
commit2b7d5d54011ffcc93511bf05f44163a4b7a1270c (patch)
tree48a88e26a12f04b3f922c9ec54c4e2db061125fb /ui/messages
parent6bb932212cbadac6eed59ac153ebe041523f7570 (diff)
Fix reply rendering infinite loop bug
Diffstat (limited to 'ui/messages')
-rw-r--r--ui/messages/base.go4
-rw-r--r--ui/messages/parser.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/ui/messages/base.go b/ui/messages/base.go
index 123c5c1..ef495fb 100644
--- a/ui/messages/base.go
+++ b/ui/messages/base.go
@@ -241,6 +241,7 @@ func (msg *UIMessage) Draw(screen mauview.Screen) {
func (msg *UIMessage) Clone() *UIMessage {
clone := *msg
+ clone.ReplyTo = nil
clone.Renderer = clone.Renderer.Clone()
return &clone
}
@@ -253,7 +254,8 @@ func (msg *UIMessage) CalculateReplyBuffer(preferences config.UserPreferences, w
}
func (msg *UIMessage) CalculateBuffer(preferences config.UserPreferences, width int) {
- msg.Renderer.CalculateBuffer(preferences, width-1, msg)
+ msg.Renderer.CalculateBuffer(preferences, width, msg)
+ msg.CalculateReplyBuffer(preferences, width)
}
func (msg *UIMessage) DrawReply(screen mauview.Screen) mauview.Screen {
diff --git a/ui/messages/parser.go b/ui/messages/parser.go
index 123f323..29f078c 100644
--- a/ui/messages/parser.go
+++ b/ui/messages/parser.go
@@ -49,9 +49,7 @@ func ParseEvent(matrix ifc.MatrixContainer, mainView ifc.MainView, room *rooms.R
}
if len(evt.Content.GetReplyTo()) > 0 {
if replyToMsg := getCachedEvent(mainView, room.ID, evt.Content.GetReplyTo()); replyToMsg != nil {
- replyToMsg = replyToMsg.Clone()
- replyToMsg.ReplyTo = nil
- msg.ReplyTo = replyToMsg
+ msg.ReplyTo = replyToMsg.Clone()
} else if replyToEvt, _ := matrix.GetEvent(room, evt.Content.GetReplyTo()); replyToEvt != nil {
if replyToMsg := directParseEvent(matrix, room, replyToEvt); replyToMsg != nil {
msg.ReplyTo = replyToMsg