primitivus (chat): fixes the messages display when opening a new chat window
This commit is contained in:
parent
3cee372b02
commit
7afc9b83fa
1 changed files with 3 additions and 2 deletions
|
|
@ -297,7 +297,8 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
if timestamp and self.content:
|
||||
for idx in range(len(self.content) - 1, -1, -1):
|
||||
current_text = self.content[idx]
|
||||
if new_text.timestamp < current_text.timestamp and idx > 0:
|
||||
older = new_text.timestamp < current_text.timestamp
|
||||
if older and idx > 0:
|
||||
continue # the new message is older, we need to insert it upper
|
||||
|
||||
#we discard double messages, to avoid backlog / history conflict
|
||||
|
|
@ -306,7 +307,7 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
(idx < len(self.content) - 2 and self.content[idx + 1].message)):
|
||||
return
|
||||
|
||||
self.content.insert(idx + 1, new_text)
|
||||
self.content.insert(0 if older else idx + 1, new_text)
|
||||
break
|
||||
else:
|
||||
self.content.append(new_text)
|
||||
|
|
|
|||
Loading…
Reference in a new issue