From d123c41cd3ad4f0d55ae134be69e7ffd144dbb74 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 18 May 2021 22:05:19 +0200 Subject: Add mention autocomplete --- src/Body.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/Body.cpp') diff --git a/src/Body.cpp b/src/Body.cpp index 2e267c5..4f2e816 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -484,6 +484,11 @@ namespace QuickMedia { // TODO: Use a render target for the whole body so all images can be put into one. // TODO: Load thumbnails with more than one thread. void Body::draw(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, const Json::Value &content_progress) { + if(items_dirty) { + items_dirty = false; + filter_search_fuzzy(current_filter); + } + sf::Vector2f scissor_pos = pos; sf::Vector2f scissor_size = size; const float start_y = pos.y; @@ -1486,10 +1491,14 @@ namespace QuickMedia { } void Body::filter_search_fuzzy(const std::string &text) { + current_filter = text; + if(text.empty()) { for(auto &item : items) { item->visible = true; } + + select_first_item(); return; } @@ -1531,4 +1540,8 @@ namespace QuickMedia { page_scroll = scroll; clamp_selected_item_to_body_count = 1; } + + void Body::items_set_dirty() { + items_dirty = true; + } } -- cgit v1.2.3