/** * Set the current buffer's content to the specified {@link String}. The * visual terminal will be modified to show the current buffer. * * @param buffer the new contents of the buffer. */ protected void setBuffer(final String buffer) { buf.clear(); buf.write(buffer); }
protected boolean quit() { getBuffer().clear(); return acceptLine(); }
protected boolean killBuffer() { killRing.add(buf.toString()); buf.clear(); return true; }
protected boolean sendBreak() { if (searchTerm == null) { buf.clear(); println(); redrawLine(); // state = State.INTERRUPT; return false; } return true; }
protected boolean expandHistory() { String str = buf.toString(); String exp = expander.expandHistory(history, str); if (!exp.equals(str)) { buf.clear(); buf.write(exp); return true; } else { return false; } }
protected void cleanup() { if (isSet(Option.ERASE_LINE_ON_FINISH)) { Buffer oldBuffer = buf.copy(); AttributedString oldPrompt = prompt; buf.clear(); prompt = new AttributedString(""); doCleanup(false); prompt = oldPrompt; buf.copyFrom(oldBuffer); } else { doCleanup(true); } }
protected boolean viRepeatSearch() { if (searchDir == 0) { return false; } int si = searchDir < 0 ? searchBackwards(searchString, searchIndex, false) : searchForwards(searchString, searchIndex, false); if (si == -1 || si == history.index()) { return false; } searchIndex = si; /* * Show the match. */ buf.clear(); history.moveTo(searchIndex); buf.write(history.get(searchIndex)); if (VICMD.equals(keyMap)) { buf.move(-1); } return true; }
buf.clear(); if (searchIndex >= 0) { buf.write(history.get(searchIndex));
protected boolean acceptLine() { parsedLine = null; if (!isSet(Option.DISABLE_EVENT_EXPANSION)) { try { String str = buf.toString(); String exp = expander.expandHistory(history, str); if (!exp.equals(str)) { buf.clear(); buf.write(exp); if (isSet(Option.HISTORY_VERIFY)) { return true; } } } catch (IllegalArgumentException e) { // Ignore } } try { parsedLine = parser.parse(buf.toString(), buf.cursor(), ParseContext.ACCEPT_LINE); } catch (EOFError e) { buf.write("\n"); return true; } catch (SyntaxError e) { // do nothing } callWidget(CALLBACK_FINISH); state = State.DONE; return true; }
buf.clear(); if (buffer != null) { buf.write(buffer);