Merge pull request #397 from n-peugnet/fix-message-redraw-first-reaction

Do not recalculate the buffer on first reaction
This commit is contained in:
Tulir Asokan 2022-11-09 18:00:59 +02:00 committed by GitHub
commit 26b3c51053
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}
}