public void arrowUp() {
    if (historyPosition == 0 || histories.isEmpty()) {
      return;
    }

    if (historyPosition == -1) {
      historyPosition = histories.size() - 1;
    } 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