From 83da1df25635c2d1c3e81223247bae0329188cc1 Mon Sep 17 00:00:00 2001 From: Nicolas Peugnet Date: Tue, 1 Nov 2022 16:02:30 +0100 Subject: [PATCH] Do not recalculate the buffer on new reaction Only the replacement is needed as the height is already correclty calculated when drawn. Fixes #283 --- ui/room-view.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ui/room-view.go b/ui/room-view.go index 7fc53f86..f910a6af 100644 --- a/ui/room-view.go +++ b/ui/room-view.go @@ -920,11 +920,10 @@ func (view *RoomView) AddReaction(evt *muksevt.Event, key string) { // Message not in view, nothing to do return } - recalculate := len(msg.Reactions) == 0 + heightChanged := len(msg.Reactions) == 0 msg.AddReaction(key) - if recalculate { - // Recalculate height for message - msg.CalculateBuffer(msgView.prevPrefs, msgView.prevWidth()) + if heightChanged { + // Replace buffer to update height of message msgView.replaceBuffer(msg, msg) } }