diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-08-13 15:55:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-13 15:55:50 +0200 |
commit | 61ab7fdf4e85417a919eb62b84a6b14c48a00a1a (patch) | |
tree | d7d5079843cb2c193b82f4a57c73f243d7ea39fd /editor/editor_help.cpp | |
parent | 985955d5b46031c2555540a3a0091f4a46bddbfe (diff) | |
parent | 95a8b2b5d9cc7d9a2b4302a9259a3035b572cd35 (diff) |
Merge pull request #31239 from YeldhamDev/script_search_matches_placement
Make the script search have a proper matches counter
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r-- | editor/editor_help.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 7aa24c7476..385b6924df 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1738,19 +1738,13 @@ void FindBar::_update_results_count() { void FindBar::_update_matches_label() { - if (results_count > 0) { - matches_label->show(); - - matches_label->add_color_override("font_color", Color(1, 1, 1)); - matches_label->set_text(vformat(TTR("Found %d match(es)."), results_count)); - } else if (search_text->get_text().empty()) { - + if (search_text->get_text().empty() || results_count == -1) { matches_label->hide(); } else { matches_label->show(); - matches_label->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); - matches_label->set_text(TTR("No Matches")); + matches_label->add_color_override("font_color", results_count > 0 ? Color(1, 1, 1) : EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count)); } } |