Fix reply rendering infinite loop bug
This commit is contained in:
		@@ -76,8 +76,8 @@ var rainbow = GradientTable{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func cmdHeapProfile(cmd *Command) {
 | 
			
		||||
	dbg.FreeOSMemory()
 | 
			
		||||
	runtime.GC()
 | 
			
		||||
	dbg.FreeOSMemory()
 | 
			
		||||
	memProfile, err := os.Create("gomuks.heap.prof")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		debug.Print("Failed to open gomuks.heap.prof:", err)
 | 
			
		||||
 
 | 
			
		||||
@@ -143,7 +143,7 @@ func (view *MessageView) AddMessage(ifcMessage ifc.Message, direction MessageDir
 | 
			
		||||
		view.replaceMessage(oldMsg, message)
 | 
			
		||||
		view.deleteMessageID(message.TxnID)
 | 
			
		||||
		direction = IgnoreMessage
 | 
			
		||||
	} else if oldMsg = view.getMessageByID(message.Relation.EventID); oldMsg != nil {
 | 
			
		||||
	} else if oldMsg = view.getMessageByID(message.Relation.GetReplaceID()); oldMsg != nil {
 | 
			
		||||
		direction = IgnoreMessage
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user