Skip to content

Commit

Permalink
Merge pull request #44301 from pycbouh/show-count-find-in-files
Browse files Browse the repository at this point in the history
Display the number of results for global search
  • Loading branch information
akien-mga authored Dec 17, 2020
2 parents b07a3f5 + 7c0d682 commit e2c0082
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion editor/find_in_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e2c0082

Please sign in to comment.