if(ControlOperatorParser.findLastRedirectionPositionBeforeCursor(buffer.getLine(), buffer.getCursor()) > pipeLinePos)
pipeLinePos = 0;
}
for(Completion completion : completionList) {
CompleteOperation co;
if(pipeLinePos > 0) {
co = findAliases(buffer.getLine().substring(pipeLinePos, buffer.getCursor()), buffer.getCursor() - pipeLinePos);
}
else {
co = findAliases(buffer.getLine(), buffer.getCursor());
}
if(getMultiLine().length() > 0) {
String multi = getMultiLine();
//TODO: must implement this
}
else
completion.complete(co);
if(co.getCompletionCandidates() != null && co.getCompletionCandidates().size() > 0)
possibleCompletions.add(co);
}
if(Settings.getInstance().isLogging())
logger.info("Found completions: "+possibleCompletions);
// not hits, just return (perhaps we should beep?)
if(possibleCompletions.size() < 1) {
//do nothing atm
}
// only one hit, do a completion
else if(possibleCompletions.size() == 1 &&
possibleCompletions.get(0).getCompletionCandidates().size() == 1) {
//some formatted completions might not be valid and shouldnt be displayed
displayCompletion(possibleCompletions.get(0).getCompletionCandidates().get(0),
possibleCompletions.get(0).getFormattedCompletionCandidates().get(0),
possibleCompletions.get(0).hasAppendSeparator(),
possibleCompletions.get(0).getSeparator());
}
// more than one hit...
else {
String startsWith = Parser.findStartsWithOperation(possibleCompletions);
if(startsWith.length() > 0)
displayCompletion("", startsWith, false, possibleCompletions.get(0).getSeparator());
// display all
// check size
else {
List<String> completions = new ArrayList<String>();
for(CompleteOperation co : possibleCompletions)
completions.addAll(co.getCompletionCandidates());
if(completions.size() > 100) {
if(displayCompletion) {
displayCompletions(completions);
displayCompletion = false;