From 7b48ab891023d76de6b13b56a8d5e205f62bc37d Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 28 May 2021 15:48:43 +0200 Subject: Improve body navigation --- src/plugins/Matrix.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index de50049..552762a 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -614,7 +614,7 @@ namespace QuickMedia { bool is_window_focused = program->is_window_focused(); RoomData *current_room = program->get_current_chat_room(); Body *chat_body = chat_page ? chat_page->chat_body : nullptr; - bool set_room_as_unread = !is_window_focused || room != current_room || (!chat_body || !chat_body->is_last_item_fully_visible()) || (chat_page && !chat_page->messages_tab_visible); + bool set_room_as_unread = !is_window_focused || room != current_room || (!chat_body || chat_body->is_bottom_cut_off()) || (chat_page && !chat_page->messages_tab_visible); std::string room_desc; if(set_room_as_unread) @@ -692,7 +692,7 @@ namespace QuickMedia { 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->select_first_item(); - body->set_selected_item(selected_item + 1, false); + body->select_next_item(); } return; } @@ -719,6 +719,7 @@ namespace QuickMedia { void MatrixRoomsPage::clear_search() { search_bar->clear(); body->filter_search_fuzzy(""); + body->select_first_item(); } void MatrixRoomsPage::clear_data() { @@ -1107,9 +1108,8 @@ namespace QuickMedia { //int prev_selected_item = notifications_body->get_selected_item(); //notifications_body->items.push_back(notification_to_body_item(notifications_body, notification)); //notifications_body->set_selected_item(prev_selected_item - 1); - int prev_selected_item = notifications_body->get_selected_item(); notifications_body->items.insert(notifications_body->items.begin(), notification_to_body_item(notifications_body, notification)); - notifications_body->set_selected_item(prev_selected_item + 1, false); + notifications_body->select_next_item(); } void MatrixNotificationsPage::set_room_as_read(RoomData *room) { -- cgit v1.2.3