summaryrefslogtreecommitdiff
path: root/poezio/text_buffer.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-06-26 18:49:42 +0200
committermathieui <mathieui@mathieui.net>2021-06-26 20:36:08 +0200
commitae3b747e94e52f14a53a53bb04db828b98369304 (patch)
tree0f2b7e5ad530bed0dca061e87b60205b5dbdaa2e /poezio/text_buffer.py
parente5b4f7ab0d2159d938fe0aa42ab7aba7cd7e6fc5 (diff)
downloadpoezio-ae3b747e94e52f14a53a53bb04db828b98369304.tar.gz
poezio-ae3b747e94e52f14a53a53bb04db828b98369304.tar.bz2
poezio-ae3b747e94e52f14a53a53bb04db828b98369304.tar.xz
poezio-ae3b747e94e52f14a53a53bb04db828b98369304.zip
fix: load less messages on startup/gap fill
gap filler was called on MUC joins, therefore loading 999 messages instead of the 2 times the screen height
Diffstat (limited to 'poezio/text_buffer.py')
-rw-r--r--poezio/text_buffer.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/poezio/text_buffer.py b/poezio/text_buffer.py
index c25c172c..2b6b3620 100644
--- a/poezio/text_buffer.py
+++ b/poezio/text_buffer.py
@@ -315,6 +315,13 @@ class TextBuffer:
return message
return None
+ def find_first_message(self) -> Optional[Message]:
+ """Find the first real message received in this buffer"""
+ for message in self.messages:
+ if isinstance(message, Message):
+ return message
+ return None
+
def __del__(self):
size = len(self.messages)
log.debug('** Deleting %s messages from textbuffer', size)