aboutsummaryrefslogtreecommitdiff
path: root/src/SearchBar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/SearchBar.cpp')
-rw-r--r--src/SearchBar.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index fa81c61..f489779 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -91,15 +91,19 @@ namespace QuickMedia {
sf::Int32 elapsed_time = time_since_search_update.getElapsedTime().asMilliseconds();
if(updated_search && elapsed_time >= text_autosearch_delay) {
updated_search = false;
- sf::String str = text.getString();
+ auto u8 = text.getString().toUtf8();
+ std::string *u8_str = (std::string*)&u8;
if(show_placeholder)
- str.clear();
+ u8_str->clear();
if(onTextUpdateCallback)
- onTextUpdateCallback(str);
+ onTextUpdateCallback(*u8_str);
} else if(updated_autocomplete && elapsed_time >= autocomplete_search_delay) {
updated_autocomplete = false;
- if(!show_placeholder && onAutocompleteRequestCallback)
- onAutocompleteRequestCallback(text.getString());
+ if(!show_placeholder && onAutocompleteRequestCallback) {
+ auto u8 = text.getString().toUtf8();
+ std::string *u8_str = (std::string*)&u8;
+ onAutocompleteRequestCallback(*u8_str);
+ }
}
}
@@ -165,10 +169,11 @@ namespace QuickMedia {
} else if(codepoint == 13) { // Return
bool clear_search = true;
if(onTextSubmitCallback) {
+ auto u8 = text.getString().toUtf8();
+ std::string *u8_str = (std::string*)&u8;
if(show_placeholder)
- clear_search = onTextSubmitCallback("");
- else
- clear_search = onTextSubmitCallback(text.getString());
+ u8_str->clear();
+ clear_search = onTextSubmitCallback(*u8_str);
}
if(clear_search)