aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SearchBar.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index d96172a..803eaee 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -20,14 +20,14 @@ namespace QuickMedia {
onAutocompleteRequestCallback(nullptr),
text_autosearch_delay(0),
autocomplete_search_delay(0),
- text(placeholder, font, 18),
+ text(placeholder, font, 18),
autocomplete_text("", font, 18),
placeholder_str(placeholder),
show_placeholder(true),
updated_search(false),
updated_autocomplete(false),
draw_logo(false),
- needs_update(false)
+ needs_update(true)
{
text.setFillColor(text_placeholder_color);
autocomplete_text.setFillColor(text_placeholder_color);
@@ -54,6 +54,12 @@ namespace QuickMedia {
// TODO: Render starting from the character after text length
window.draw(autocomplete_text);
window.draw(text);
+ if(show_placeholder || text.getString().isEmpty())
+ caret.setPosition(text.getPosition() - sf::Vector2f(2.0f, 0.0f));
+ else
+ caret.setPosition(text.findCharacterPos(text.getString().getSize()));
+
+ window.draw(caret);
if(draw_logo)
window.draw(plugin_logo_sprite);
}
@@ -105,6 +111,7 @@ namespace QuickMedia {
background.setSize(sf::Vector2f(width, rect_height));
shade.setSize(sf::Vector2f(window_size.x, padding_vertical + rect_height + padding_vertical));
+ caret.setSize(sf::Vector2f(2.0f, text.getLocalBounds().height + 12.0f));
background_shadow.setSize(sf::Vector2f(window_size.x, 5.0f));
background.setPosition(offset_x, padding_vertical);