Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display the number of results for global search #44301

Merged
merged 1 commit into from
Dec 17, 2020

Conversation

YuriSizov
Copy link
Contributor

@YuriSizov YuriSizov commented Dec 11, 2020

This replaces the ambiguous "Search complete" phrase with the actual number of results found in files.

godot windows tools 64_2020-12-11_19-09-44

This especially helps when doing refactoring and clicking "Refresh" to repeat the search.

Bugsquad edit: This partially addresses godotengine/godot-proposals#600.

@Calinou Calinou added cherrypick:3.x Considered for cherry-picking into a future 3.x release enhancement topic:editor usability labels Dec 11, 2020
@Calinou Calinou added this to the 4.0 milestone Dec 11, 2020
Comment on lines +786 to +792
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);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good use case to start using the newly implemented plurals support with TTRN(): #40443.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, didn't think about it. Will look into.

Copy link
Contributor Author

@YuriSizov YuriSizov Dec 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a second thought, this is probably not a good use case for that, because there are 2 numbers and 3 permutations between them. Not sure how TTRN would help here. I'd be able to check either result_count or file_count, but the third option would still be separate. Picking one over the other seems arbitrary, no?

Edit: Unless you propose we split them into two and TTRN each part individually?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd need to think more about it, but let's keep it simple for now and possibly improve laters. We haven't used TTRN anywhere in the translations yet, there are several places which could benefit from it.

@akien-mga akien-mga merged commit e2c0082 into godotengine:master Dec 17, 2020
@akien-mga
Copy link
Member

Thanks!

@YuriSizov YuriSizov deleted the show-count-find-in-files branch December 19, 2020 14:18
@akien-mga
Copy link
Member

Cherry-picked for 3.2.4.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants