public boolean complete(final ConsoleReader reader, final List<CharSequence> candidates, final int pos) throws IOException { CursorBuffer buf = reader.getCursorBuffer(); // if there is only one completion, then fill in the buffer if (candidates.size() == 1) { String value = Ansi.stripAnsi(candidates.get(0).toString()); if (buf.cursor == buf.buffer.length() && printSpaceAfterFullCompletion && !value.endsWith(" ")) { value += " "; } // fail if the only candidate is the same as the current buffer if (value.equals(buf.toString())) { return false; } setBuffer(reader, value, pos); return true; } else if (candidates.size() > 1) { String value = getUnambiguousCompletions(candidates); setBuffer(reader, value, pos); } printCandidates(reader, candidates); // redraw the current console buffer reader.drawLine(); return true; }
public boolean complete(final ConsoleReader reader, final List<CharSequence> candidates, final int pos) throws IOException { CursorBuffer buf = reader.getCursorBuffer(); // if there is only one completion, then fill in the buffer if (candidates.size() == 1) { String value = Ansi.stripAnsi(candidates.get(0).toString()); if (buf.cursor == buf.buffer.length() && printSpaceAfterFullCompletion && !value.endsWith(" ")) { value += " "; } // fail if the only candidate is the same as the current buffer if (value.equals(buf.toString())) { return false; } setBuffer(reader, value, pos); return true; } else if (candidates.size() > 1) { String value = getUnambiguousCompletions(candidates); setBuffer(reader, value, pos); } printCandidates(reader, candidates); // redraw the current console buffer reader.drawLine(); return true; }
public boolean complete(ConsoleReader reader, @SuppressWarnings("rawtypes") List<CharSequence> candidates, int pos) throws IOException { CursorBuffer buf = reader.getCursorBuffer(); // if there is only one completion, then fill in the buffer if (candidates.size() == 1) { String value = candidates.get(0).toString(); // fail if the only candidate is the same as the current buffer if (value.equals(buf.toString())) { return false; } jline.console.completer.CandidateListCompletionHandler.setBuffer(reader, value, pos); return true; } if (candidates.size() > 1) { String value = getUnambiguousCompletions(candidates); jline.console.completer.CandidateListCompletionHandler.setBuffer(reader, value, pos); } if (eagerNewlines) { reader.println(); } jline.console.completer.CandidateListCompletionHandler.printCandidates(reader, candidates); // redraw the current console buffer reader.drawLine(); return true; }