public void arrowDown() {
    if (historyPosition == -1 || histories.isEmpty()) {
      return;
    }

    if (historyPosition == histories.size() - 1) {
      historyPosition = -1;
      inputString = new StringBuilder();
    } else {
      historyPosition += 1;
      inputString = new StringBuilder(histories.get(historyPosition));
    }

    cursorPosition = inputString.length();
    inputModeScreenView.showInput(message, inputString.toString(), cursorPosition);
    inputModeScreenView.refreshTerminal();
  }
The presentation logic for the input mode.
hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/top/InputModeScreenPresenter.java