diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-02-09 22:13:27 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-02-09 22:13:50 +0100 |
commit | e1bbef2d64de09e0eef88410d69ac772d34d79ad (patch) | |
tree | 84f221e51443b99965d26809e63b03305d2b3600 /src/plugins/Matrix.cpp | |
parent | 31be2fd556fbfd6679ca2bcc131450e6853c155e (diff) |
Matrix: final room sort, hide room list behind reply/edit
Diffstat (limited to 'src/plugins/Matrix.cpp')
-rw-r--r-- | src/plugins/Matrix.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 8c9b1c1..d3e8117 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -674,13 +674,17 @@ namespace QuickMedia { for(size_t i = 0; i < body->items.size(); ++i) { RoomData *room_i = static_cast<RoomData*>(body->items[i]->userdata); - if((int)i != selected_item && room_i && room->last_message_timestamp > room_i->last_message_timestamp) { + if((int)i == room_body_index) + return; + if((int)i != selected_item && room_i && room->last_message_timestamp >= room_i->last_message_timestamp) { auto body_item_to_insert = body->items[room_body_index]; body->items.erase(body->items.begin() + room_body_index); - if((int)i <= room_body_index) + if(room_body_index >= (int)i) body->items.insert(body->items.begin() + i, std::move(body_item_to_insert)); else body->items.insert(body->items.begin() + (i - 1), std::move(body_item_to_insert)); + if((int)i < selected_item && room_body_index > selected_item && body->items.size() > 1 && i != body->items.size() - 1) + body->set_selected_item(selected_item + 1); return; } } |