protected boolean endOfHistory() { if (history.moveToLast()) { setBuffer(history.current()); return true; } else { return false; } }
protected boolean beginningOfHistory() { if (history.moveToFirst()) { setBuffer(history.current()); return true; } else { return false; } }
/** * Move up or down the history tree. * @param next <code>true</code> to go to the next, <code>false</code> for the previous. * @return <code>true</code> if successful, <code>false</code> otherwise */ protected boolean moveHistory(final boolean next) { if (!buf.toString().equals(history.current())) { modifiedHistory.put(history.index(), buf.toString()); } if (next && !history.next()) { return false; } else if (!next && !history.previous()) { return false; } setBuffer(modifiedHistory.containsKey(history.index()) ? modifiedHistory.get(history.index()) : history.current()); return true; }
protected boolean historySearchBackward() { if (historyBuffer == null || buf.length() == 0 || !buf.toString().equals(history.current())) { historyBuffer = buf.copy(); searchBuffer = getFirstWord(); } int searchIndex = searchBackwards(searchBuffer.toString(), history.index(), true); if (searchIndex == -1) { return false; } else { // Maintain cursor position while searching. if (history.moveTo(searchIndex)) { setBuffer(history.current()); } else { return false; } } return true; }