aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-06-27 09:53:22 +0200
committerdec05eba <dec05eba@protonmail.com>2022-06-27 09:53:22 +0200
commit9650dba396e737649254050f6e421adf611766c8 (patch)
treeea2365f984d260d0b33f9317f794baec780bce9a /src
parent7c991b4d29e410c854669b36d707b684c695f047 (diff)
Better clearing of items for fast search
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 770ef18..147afd9 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -2616,16 +2616,9 @@ namespace QuickMedia {
if(associated_data.search_text_updated && associated_data.fetch_status == FetchStatus::NONE && !associated_data.fetching_next_page_running) {
associated_data.search_text_empty = associated_data.update_search_text.empty();
std::string update_search_text = associated_data.update_search_text;
- tabs[i].body->clear_items();
- if(tabs[i].page->search_is_suggestion(associated_data.search_text_empty) && tabs[i].body) {
- if(update_search_text.empty())
- tabs[i].body->card_view = tab_associated_data[selected_tab].card_view;
- else
- tabs[i].body->card_view = false;
- } else {
- tabs[i].body->card_view = tab_associated_data[selected_tab].card_view;
- }
+ if(tabs[i].body && (!tabs[i].page->search_is_suggestion(associated_data.search_text_empty) || associated_data.search_suggestion_submitted))
+ tabs[i].body->clear_items();
associated_data.search_text_updated = false;
associated_data.fetch_status = FetchStatus::LOADING;
@@ -2641,6 +2634,15 @@ namespace QuickMedia {
}
if(associated_data.fetch_status == FetchStatus::LOADING && associated_data.fetch_type == FetchType::SEARCH && associated_data.fetch_future.ready()) {
+ if(tabs[i].page->search_is_suggestion(associated_data.search_text_empty) && tabs[i].body) {
+ if(associated_data.update_search_text.empty())
+ tabs[i].body->card_view = tab_associated_data[selected_tab].card_view;
+ else
+ tabs[i].body->card_view = false;
+ } else {
+ tabs[i].body->card_view = tab_associated_data[selected_tab].card_view;
+ }
+
if(!associated_data.search_text_updated) {
FetchResult fetch_result = associated_data.fetch_future.get();
tabs[i].body->set_items(std::move(fetch_result.body_items));