Commit 981c47c3 authored by Dicson's avatar Dicson

[Slava]do not lose received history position when a new incoming message arrives. Fixes #6822

parent c6869674
......@@ -875,19 +875,27 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
# save the message, so user can scroll though the list with key up/down
if msg_type == 'sent':
history = self.sent_history
pos = self.sent_history_pos
else:
history = self.received_history
size = len(self.sent_history)
pos = self.received_history_pos
size = len(history)
scroll = False if pos == size else True # are we scrolling?
# we don't want size of the buffer to grow indefinately
max_size = gajim.config.get('key_up_lines')
for i in xrange(size - max_size + 1):
if pos == 0:
break
history.pop(0)
pos -= 1
history.append(message)
if not scroll or msg_type == 'sent':
pos = len(history)
if msg_type == 'sent':
self.sent_history_pos = len(history)
self.sent_history_pos = pos
self.orig_msg = None
else:
self.received_history_pos = len(history)
self.orig_msg = None
self.received_history_pos = pos
def print_conversation_line(self, text, kind, name, tim,
other_tags_for_name=[], other_tags_for_time=[],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment