/** * 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; }