reader.println(); jline.console.completer.CandidateListCompletionHandler.printCandidates(reader, candidates);
protected void printCompletionCandidates() throws IOException { // debug ("tab for (" + buf + ")"); if (completers.size() == 0) { return; } List<CharSequence> candidates = new LinkedList<CharSequence>(); String bufstr = buf.buffer.toString(); int cursor = buf.cursor; for (Completer comp : completers) { if (comp.complete(bufstr, cursor, candidates) != -1) { break; } } CandidateListCompletionHandler.printCandidates(this, candidates); drawLine(); }
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; }
protected void printCompletionCandidates() throws IOException { // debug ("tab for (" + buf + ")"); if (completers.size() == 0) { return; } List<CharSequence> candidates = new LinkedList<CharSequence>(); String bufstr = buf.buffer.toString(); int cursor = buf.cursor; for (Completer comp : completers) { if (comp.complete(bufstr, cursor, candidates) != -1) { break; } } CandidateListCompletionHandler.printCandidates(this, candidates); drawLine(); }
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; }