diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2020-12-17 10:04:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-17 10:04:50 +0100 |
commit | e2c0082b6a28744e315e03016d3108dc53f27215 (patch) | |
tree | 2d6a9e1a9c7d747bd23649be046bc9f9000ce19c | |
parent | b07a3f503b75831414f92d2cc6886d045eeb96fb (diff) | |
parent | 7c0d68295141598f0d91eae4a7935cece3c67f9e (diff) |
Merge pull request #44301 from pycbouh/show-count-find-in-files
Display the number of results for global search
-rw-r--r-- | editor/find_in_files.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 8c82eca452..076b873eac 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -779,7 +779,19 @@ void FindInFilesPanel::_on_item_edited() { } void FindInFilesPanel::_on_finished() { - _status_label->set_text(TTR("Search complete")); + String results_text; + int result_count = _result_items.size(); + int file_count = _file_items.size(); + + 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(); |