Skip to content

Commit

Permalink
command script tab completions: auto reduce for startsWith
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 27, 2020
1 parent 28b52c4 commit f728e09
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -236,15 +236,20 @@ public List<String> runTabCompleteProcedure(PlayerTag player, NPCTag npc, Map<St
tagContext.contextSource = oecs;
contextSrc = oecs;
}
ListTag list = new ListTag();
List<String> list = new ArrayList<>();
if (tabCompletionTaggables != null) {
int argCount = Math.max(originalArguments.length, 1);
String taggable = tabCompletionTaggables.get(argCount);
if (taggable == null) {
taggable = tabCompletionTaggables.get(-1);
}
if (taggable != null) {
list.addAll(ListTag.getListFor(TagManager.tagObject(taggable, tagContext), tagContext));
String argLow = originalArguments.length == 0 ? "" : CoreUtilities.toLowerCase(originalArguments[originalArguments.length - 1]);
for (String value : ListTag.getListFor(TagManager.tagObject(taggable, tagContext), tagContext)) {
if (CoreUtilities.toLowerCase(value).startsWith(argLow)) {
list.add(value);
}
}
}
}
if (hasProcStyleTabComplete) {
Expand Down

0 comments on commit f728e09

Please sign in to comment.