return;
// Add command to command history
- commandHistory.add(command);
- if(commandHistory.size() > COMMAND_HISTORY_SIZE*2)
- commandHistory = new ArrayList<String>(
- commandHistory.subList(COMMAND_HISTORY_SIZE, COMMAND_HISTORY_SIZE*2));
+ if(commandHistory.isEmpty() || !commandHistory.get(commandHistory.size()-1).equals(command)) {
+ commandHistory.add(command);
+ if(commandHistory.size() > COMMAND_HISTORY_SIZE*2)
+ commandHistory = new ArrayList<String>(
+ commandHistory.subList(COMMAND_HISTORY_SIZE, COMMAND_HISTORY_SIZE*2));
+ }
commandHistoryPos = commandHistory.size();
// Print it into output area