src/main/java/seedu/address/ui/CommandBox.java
@FXML
    private void handleCommandEntered() {
        try {
            commandExecutor.execute(commandTextField.getText());
            if (mainCommandStack.isEmpty() || !mainCommandStack.peek()
                .equals(commandTextField.getText())) {
                mainCommandStack.push(commandTextField.getText());
                leftCommandStack.clear();
                leftCommandStack.addAll(mainCommandStack);
                rightCommandStack.clear();
            } else if (!mainCommandStack.isEmpty() && mainCommandStack.peek()
                .equals(commandTextField.getText())) {
                if (!rightCommandStack.isEmpty()) {
                    String commandStr = rightCommandStack.pop();
                    commandTextField.setText(commandStr);
                    leftCommandStack.push(commandStr);
                }
            }
            commandTextField.setText("");
        } catch (CommandException | ParseException e) {
            setStyleToIndicateCommandFailure();
        }
    }
/**
     * Handles the Enter button pressed event.
     */
Handles the Enter button pressed event.
Handles the Enter button pressed event .
@FXML
    private void handleCommandEntered() {
        try {
            commandExecutor.execute(commandTextField.getText());
            if (mainCommandStack.isEmpty() || !mainCommandStack.peek()
                .equals(commandTextField.getText())) {
                mainCommandStack.push(commandTextField.getText());
                leftCommandStack.clear();
                leftCommandStack.addAll(mainCommandStack);
                rightCommandStack.clear();
            } else if (!mainCommandStack.isEmpty() && mainCommandStack.peek()
                .equals(commandTextField.getText())) {
                if (!rightCommandStack.isEmpty()) {
                    String commandStr = rightCommandStack.pop();
                    commandTextField.setText(commandStr);
                    leftCommandStack.push(commandStr);
                }
            }
            commandTextField.setText("");
        } catch (CommandException | ParseException e) {
            setStyleToIndicateCommandFailure();
        }
    }
@ FXML private void handleCommandEntered ( ) { try { commandExecutor . execute ( commandTextField . getText ( ) ) ; if ( mainCommandStack . isEmpty ( ) || ! mainCommandStack . peek ( ) . equals ( commandTextField . getText ( ) ) ) { mainCommandStack . push ( commandTextField . getText ( ) ) ; leftCommandStack . clear ( ) ; leftCommandStack . addAll ( mainCommandStack ) ; rightCommandStack . clear ( ) ; } else if ( ! mainCommandStack . isEmpty ( ) && mainCommandStack . peek ( ) . equals ( commandTextField . getText ( ) ) ) { if ( ! rightCommandStack . isEmpty ( ) ) { String commandStr = rightCommandStack . pop ( ) ; commandTextField . setText ( commandStr ) ; leftCommandStack . push ( commandStr ) ; } } commandTextField . setText ( "" ) ; } catch ( CommandException | ParseException e ) { setStyleToIndicateCommandFailure ( ) ; } }
Handles the Enter button pressed event.
Handles the Enter button pressed event .