diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Body.cpp | 13 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 2 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 1 | ||||
-rw-r--r-- | src/plugins/Youtube.cpp | 8 |
4 files changed, 11 insertions, 13 deletions
diff --git a/src/Body.cpp b/src/Body.cpp index a1eb592..bc56ef8 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -218,12 +218,12 @@ namespace QuickMedia { return -1; } - void Body::select_first_item() { + void Body::select_first_item(bool reset_page_scroll) { selected_item = 0; - //if(attach_side == AttachSide::TOP) { - // prev_selected_item = selected_item; - // page_scroll = 0.0f; - //} + if(attach_side == AttachSide::TOP && reset_page_scroll) { + prev_selected_item = selected_item; + page_scroll = 0.0f; + } clamp_selection(); } @@ -355,7 +355,7 @@ namespace QuickMedia { return true; } else if(event.key.code == sf::Keyboard::Home) { render_selected_item_bg = true; - select_first_item(); + select_first_item(false); if(on_top_reached) on_top_reached(); return true; @@ -1058,6 +1058,7 @@ namespace QuickMedia { } } else if(item->thumbnail_size.x > 0) { text_offset_x += image_padding_x + content_size.x; + // TODO: Fix. This makes the body item have incorrect position when loading and if the item is merge_with_previous? and has an embedded item //if(!merge_with_previous) // image_height = content_size.y; } diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 4b81b7b..43ccbaf 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -5203,7 +5203,7 @@ namespace QuickMedia { move_room = true; goto chat_page_end; } else if(event.key.code == sf::Keyboard::Home) { - matrix_chat_page->rooms_page->body->select_first_item(); + matrix_chat_page->rooms_page->body->select_first_item(false); move_room = true; goto chat_page_end; } else if(event.key.code == sf::Keyboard::End) { diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 552762a..f9cdab5 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -691,7 +691,6 @@ namespace QuickMedia { 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->select_first_item(); body->select_next_item(); } return; diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index e4f152f..d164bc5 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -813,11 +813,9 @@ namespace QuickMedia { } std::optional<std::string> vote_count = yt_json_get_text(comment_renderer_json, "voteCount"); - if(vote_count) { - if(!description.empty()) - description += '\n'; - description += "👍 " + vote_count.value(); - } + if(!description.empty()) + description += '\n'; + description += "👍 " + vote_count.value_or("0"); const Json::Value &reply_count_json = comment_renderer_json["replyCount"]; if(reply_count_json.isInt64() && reply_count_json.asInt64() > 0) { |