summaryrefslogtreecommitdiff
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-08-13 15:55:50 +0200
committerGitHub <noreply@github.com>2019-08-13 15:55:50 +0200
commit61ab7fdf4e85417a919eb62b84a6b14c48a00a1a (patch)
treed7d5079843cb2c193b82f4a57c73f243d7ea39fd /editor/editor_help.cpp
parent985955d5b46031c2555540a3a0091f4a46bddbfe (diff)
parent95a8b2b5d9cc7d9a2b4302a9259a3035b572cd35 (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.cpp12
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));
}
}