void (@NotNull final AnActionEvent e) { boolean hasHistory = getModel().hasHistory(); // need to check before next line's side effect Entry command = myNext ? getModel().getHistoryNext() : getModel().getHistoryPrev(); if (!myMultiline && command == null || !hasHistory && !myNext) return; setConsoleText(command, !hasHistory, true); if (isMoveCaretToTheFirstLine && myNext) { EditorEx consoleEditor = myConsole.getConsoleEditor(); consoleEditor.getCaretModel().moveToOffset(consoleEditor.getDocument().getLineEndOffset(0)); } }