!752 p { final JTextField input = consoleInputField(); if (input != null && !isTrue(getOpt(getOpt(getJavaX(), "console"), "hasHistory"))) { final Var historyIdx = new Var(0); final new L history; input.addKeyListener(new KeyAdapter { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { print("up"); listSet(history, historyIdx.get(), input.getText()); historyIdx.set(max(0, historyIdx.get()-1)); S text = get(history, historyIdx.get()); if (text != null) { input.setText(text); input.selectAll(); } } if (e.getKeyCode() == KeyEvent.VK_DOWN) { print("down"); S text = input.getText(); if (historyIdx.get() < l(history) || neq(last(history), text)) listSet(history, historyIdx.get(), text); historyIdx.set(min(l(history), historyIdx.get()+1)); text = get(history, historyIdx.get()); input.setText(unnull(text)); input.selectAll(); } } }); //ActionListener[] l = input.getActionListeners(); //for (ActionListener a : l) input.removeActionListener(a); input.addActionListener(actionListener { S text = input.getText(); print("Text: " + text); if (nempty(text)) { history.remove(text); history.add(text); } historyIdx.set(l(history)); }); //for (ActionListener a : l) input.addActionListener(a); } }