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

Auto complete /mail clear indices #5132

Merged
merged 2 commits into from
Oct 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,21 @@ protected List<String> getTabCompleteOptions(final Server server, final User use
if (pages == 0) {
return Lists.newArrayList("0");
} else {
final List<String> options = Lists.newArrayList("1");
if (pages > 1) {
options.add(String.valueOf(pages));
final List<String> options = new ArrayList<>();
for (int i = 0; i < pages; i++) {
options.add(String.valueOf(i + 1));
}
return options;
}
} else if (args[0].equalsIgnoreCase("clear")) {
final ArrayList<MailMessage> mail = user.getMailMessages();
// We show up to 9 mails on a page, we don't need to autocomplete more than that...
if (mail.size() >= 9) {
return Lists.newArrayList("1", "2", "3", "4", "5", "6", "7", "8", "9");
} else {
final List<String> options = new ArrayList<>();
for (int i = 0; i < mail.size(); i++) {
options.add(String.valueOf(i + 1));
}
return options;
}
Expand Down