// Show the command from the command history, pointed to by the index. // Note that the index runs in reverse. private void showHistory() { String lShowLine; if (commandHistoryIndex == 0) lShowLine = currentCommand; else lShowLine = commandHistory.get(commandHistory.size() - commandHistoryIndex); replaceConsoleText(lShowLine, commandPos, textLength()); text.setCaretPosition(textLength()); text.repaint(); }
private void moveCaret() { if (text.getCaretPosition() < commandPos) { text.setCaretPosition(textLength()); } text.repaint(); }