From 4d66d2aebd555bed32869b874e58f2ba02be3005 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Fri, 11 Dec 2020 19:13:33 +0300 Subject: [PATCH] Display the number of results for global search (cherry picked from commit 7c0d68295141598f0d91eae4a7935cece3c67f9e) --- editor/find_in_files.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index f47251026aa..a9512f78817 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -732,8 +732,19 @@ void FindInFilesPanel::_on_item_edited() { } void FindInFilesPanel::_on_finished() { + String results_text; + int result_count = _result_items.size(); + int file_count = _file_items.size(); - _status_label->set_text(TTR("Search complete")); + if (result_count == 1 && file_count == 1) { + results_text = vformat(TTR("%d match in %d file."), result_count, file_count); + } else if (result_count != 1 && file_count == 1) { + results_text = vformat(TTR("%d matches in %d file."), result_count, file_count); + } else { + results_text = vformat(TTR("%d matches in %d files."), result_count, file_count); + } + + _status_label->set_text(results_text); update_replace_buttons(); set_progress_visible(false); _refresh_button->show();