aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO4
-rw-r--r--src/QuickMedia.cpp22
2 files changed, 17 insertions, 9 deletions
diff --git a/TODO b/TODO
index d15119e..4cbaef1 100644
--- a/TODO
+++ b/TODO
@@ -33,4 +33,6 @@ Scrolling past page causes the page to jump up and down very fast because the ne
Add setting to disable sending typing events to the server (matrix).
Support emoji (mainly for matrix), by readding Text code from dchat. Also do the same but for inline images, text editing and url colors and clicking (also clicking on inline images).
Also take code from dchat to support gifs (inline in text).
-Fix page jumping up/down in image continuous mode when scrolling past images that fail to load / scrolling fast. \ No newline at end of file
+Fix page jumping up/down in image continuous mode when scrolling past images that fail to load / scrolling fast.
+Use pixel buffer object for asynchronous texture transfer to gpu? is this necessary?
+When pressing backspace to delete text, auto search will kick in because the key repeat delay is longer on the first key. SearchBar should instead check of key press/key release state. \ No newline at end of file
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 05b65ea..cec7531 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -955,6 +955,7 @@ namespace QuickMedia {
void Program::search_suggestion_page() {
std::string update_search_text;
+ bool search_text_updated = false;
bool search_running = false;
bool typing = false;
bool is_fourchan = current_plugin->name == "4chan";
@@ -1035,10 +1036,11 @@ namespace QuickMedia {
std::string recommended_filter;
- search_bar->onTextUpdateCallback = [&update_search_text, this, &tabs, &selected_tab, &typing, &recommended_body, &recommended_filter](const std::string &text) {
- if(tabs[selected_tab].body == body && !current_plugin->search_is_filter())
+ search_bar->onTextUpdateCallback = [&update_search_text, &search_text_updated, this, &tabs, &selected_tab, &typing, &recommended_body, &recommended_filter](const std::string &text) {
+ if(tabs[selected_tab].body == body && !current_plugin->search_is_filter()) {
update_search_text = text;
- else {
+ search_text_updated = true;
+ } else {
tabs[selected_tab].body->filter_search_fuzzy(text);
tabs[selected_tab].body->select_first_item();
}
@@ -1147,7 +1149,7 @@ namespace QuickMedia {
if(tabs[selected_tab].body)
search_bar->update();
- if(!update_search_text.empty() && !search_running) {
+ if(search_text_updated && !search_running) {
search_suggestion_future = std::async(std::launch::async, [this, update_search_text]() {
BodyItems result;
if(current_plugin->update_search_suggestions(update_search_text, result) != SuggestionResult::OK) {
@@ -1156,11 +1158,12 @@ namespace QuickMedia {
return result;
});
update_search_text.clear();
+ search_text_updated = false;
search_running = true;
}
if(search_running && search_suggestion_future.valid() && search_suggestion_future.wait_for(std::chrono::seconds(0)) == std::future_status::ready) {
- if(update_search_text.empty()) {
+ if(!search_text_updated) {
body->items = search_suggestion_future.get();
body->clamp_selection();
} else {
@@ -2383,6 +2386,7 @@ namespace QuickMedia {
void Program::content_list_page() {
std::string update_search_text;
+ bool search_text_updated = false;
bool search_running = false;
std::future<BodyItems> search_future;
@@ -2397,12 +2401,13 @@ namespace QuickMedia {
return;
}
- search_bar->onTextUpdateCallback = [this, &update_search_text](const std::string &text) {
+ search_bar->onTextUpdateCallback = [this, &update_search_text, &search_text_updated](const std::string &text) {
if(current_plugin->content_list_search_is_filter()) {
body->filter_search_fuzzy(text);
body->select_first_item();
} else {
update_search_text = text;
+ search_text_updated = true;
}
};
@@ -2439,7 +2444,7 @@ namespace QuickMedia {
search_bar->update();
- if(!update_search_text.empty() && !search_running) {
+ if(search_text_updated && !search_running) {
search_future = std::async(std::launch::async, [this, update_search_text]() {
BodyItems result;
if(current_plugin->content_list_search(content_list_url, update_search_text, result) != SearchResult::OK) {
@@ -2448,11 +2453,12 @@ namespace QuickMedia {
return result;
});
update_search_text.clear();
+ search_text_updated = false;
search_running = true;
}
if(search_running && search_future.valid() && search_future.wait_for(std::chrono::seconds(0)) == std::future_status::ready) {
- if(update_search_text.empty()) {
+ if(!search_text_updated) {
body->items = search_future.get();
body->select_first_item();
} else {