From 140782c395175345363d6de9cbaf67a024ddf7d8 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Tue, 13 Apr 2021 04:35:10 -0400 Subject: fix splitting breaking on new messages --- components/chatwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'components/chatwindow.cpp') diff --git a/components/chatwindow.cpp b/components/chatwindow.cpp index 8235a21..9f5ec6e 100644 --- a/components/chatwindow.cpp +++ b/components/chatwindow.cpp @@ -239,9 +239,11 @@ void ChatWindow::ProcessNewMessage(Snowflake id, bool prepend) { else last_row = dynamic_cast(m_list->get_row_at_index(m_num_rows - 1)); - if (last_row != nullptr) - if (last_row->UserID == data->Author.ID && (prepend || (id - last_row->NewestID < SnowflakeSplitDifference * Snowflake::SecondsInterval))) + if (last_row != nullptr) { + const uint64_t diff = std::max(id, last_row->NewestID) - std::min(id, last_row->NewestID); + if (last_row->UserID == data->Author.ID && (prepend || (diff < SnowflakeSplitDifference * Snowflake::SecondsInterval))) should_attach = true; + } } m_num_messages++; -- cgit v1.2.3