aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-11-01 07:50:24 +0100
committerdec05eba <dec05eba@protonmail.com>2018-11-01 07:50:28 +0100
commit3c5eb7000709606eccd34114e8bf4e851dcacd6a (patch)
tree777c3aa1488170bcca033a9ba67ae4e0af19b15e
parent0469c43a45310b6b92eb704773e3a34beb57f288 (diff)
Do not scroll to bottom / redraw when loading from cache
-rw-r--r--src/ChatWindow.cpp4
1 files 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());