From 3c5eb7000709606eccd34114e8bf4e851dcacd6a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 1 Nov 2018 07:50:24 +0100 Subject: Do not scroll to bottom / redraw when loading from cache --- src/ChatWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ChatWindow.cpp b/src/ChatWindow.cpp index 98c4269..c82e7fa 100644 --- a/src/ChatWindow.cpp +++ b/src/ChatWindow.cpp @@ -188,7 +188,7 @@ namespace dchat message->text.set_text(message->text.get_text() + "\n" + request.message.text); // Since messages that are sent withing a timeframe are combined, several message ids can refer to the same message messageById[request.message.id] = message; - if(*request.room->id == *currentRoom->id) + if(!request.loadedFromCache && *request.room->id == *currentRoom->id) { auto adj = messageArea.get_vadjustment(); adj->set_value(adj->get_upper()); @@ -208,7 +208,7 @@ namespace dchat messageAreaLayout.attach(*message, 0, roomMessages.size(), 1, 1); // TODO: When we get a message in the current room we scroll to the bottom, but this should only be done if we are not manually scrolling to view old messages - if(*request.room->id == *currentRoom->id) + if(!request.loadedFromCache && *request.room->id == *currentRoom->id) { auto adj = messageArea.get_vadjustment(); adj->set_value(adj->get_upper()); -- cgit v1.2.3