From bb4873e27d14160a156d219f830638c0215ee316 Mon Sep 17 00:00:00 2001
From: wurstsalat <mailtrash@posteo.de>
Date: Sun, 28 Mar 2021 16:45:41 +0200
Subject: [PATCH] ConversationTextview: Fix vertical size allocation

---
 gajim/gtk/conversation_textview.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gajim/gtk/conversation_textview.py b/gajim/gtk/conversation_textview.py
index d9b34b2230..9534fc7d67 100644
--- a/gajim/gtk/conversation_textview.py
+++ b/gajim/gtk/conversation_textview.py
@@ -15,6 +15,7 @@
 import logging
 from urllib.parse import quote
 
+from gi.repository import GLib
 from gi.repository import GObject
 from gi.repository import Gtk
 from gi.repository import Pango
@@ -210,6 +211,11 @@ def print_text(self, text, other_text_tags=None, kind=None, graphics=True,
         self.parse_formatting(
             text, text_tags, graphics=graphics, additional_data=additional_data)
 
+        # Queue a widget resize after the Textview has been populated.
+        # This prevents for example large allocations of vertial space (blank
+        # space after the text) for messages containing many line breaks.
+        GLib.idle_add(self.queue_resize)
+
     def parse_formatting(self, text, text_tags, graphics=True,
                          additional_data=None):
         '''
-- 
GitLab