Skip to content

Commit

Permalink
skip extra whitespace in autocompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Revxrsal committed Sep 22, 2024
1 parent 02809b7 commit 891cb88
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private List<String> complete(ExecutableCommand<A> possible, MutableStringStream
break;
}
if (input.remaining() == 1 && input.peek() == ' ') {
input.moveForward();
input.skipWhitespace();
return promptWith(child, actor, context, input);
}

Expand All @@ -132,7 +132,7 @@ private List<String> complete(ExecutableCommand<A> possible, MutableStringStream
}
if (input.canRead(1) && input.peek() == ' ') {
// our literal is just fine. move to the next node
input.moveForward();
input.skipWhitespace();
continue;
}
}
Expand All @@ -153,7 +153,7 @@ private List<String> complete(ExecutableCommand<A> possible, MutableStringStream
}
return filter(parameter.complete(actor, input, context), s -> startsWithIgnoreCase(s, consumed));
} else if (input.peek() == ' ') {
input.moveForward();
input.skipWhitespace();
}
} catch (Throwable e) {
// user inputted invalid input. what do we do here?
Expand Down Expand Up @@ -233,7 +233,7 @@ private void tryParseFlag(@NotNull ParameterNode<A, Object> parameter, MutableSt
context.addResolvedArgument(parameter.name(), true);
} else {
try {
input.moveForward();
input.skipWhitespace();
if (parameter.isSwitch()) {
context.addResolvedArgument(parameter.name(), true);
return;
Expand Down

0 comments on commit 891cb88

Please sign in to comment.