private List<String> resetCompletions() {
    String text = getText();
    updateCurrentWord(false);
    completions = null;
    if (isEqualsRequired && !text.startsWith("=")) return null;

    boolean korean = app.getLocale().getLanguage().equals("ko");

    //    start autocompletion only for words with at least two characters
    if (korean) {
      if (Korean.flattenKorean(curWord.toString()).length() < 2) {
        completions = null;
        return null;
      }
    } else {
      if (curWord.length() < 2) {
        completions = null;
        return null;
      }
    }
    cmdPrefix = curWord.toString();

    if (korean) completions = dict.getCompletionsKorean(cmdPrefix);
    else completions = dict.getCompletions(cmdPrefix);

    completions = getSyntaxes(completions);
    return completions;
  }
  public void keyPressed(KeyEvent e) {
    int keyCode = e.getKeyCode();

    // we don't want to trap AltGr
    // as it is used eg for entering {[}] is some locales
    // NB e.isAltGraphDown() doesn't work
    if (e.isAltDown() && e.isControlDown()) return;

    // swallow eg ctrl-a ctrl-b ctrl-p on Mac
    if (Application.MAC_OS && e.isControlDown()) e.consume();

    ctrlC = false;

    switch (keyCode) {
      case KeyEvent.VK_Z:
      case KeyEvent.VK_Y:
        if (Application.isControlDown(e)) {
          app.getGlobalKeyDispatcher().handleGeneralKeys(e);
          e.consume();
        }
        break;

      case KeyEvent.VK_0:
      case KeyEvent.VK_1:
      case KeyEvent.VK_2:
      case KeyEvent.VK_3:
      case KeyEvent.VK_4:
      case KeyEvent.VK_5:
      case KeyEvent.VK_6:
      case KeyEvent.VK_7:
      case KeyEvent.VK_8:
      case KeyEvent.VK_9:
        if (Application.isControlDown(e) && e.isShiftDown())
          app.getGlobalKeyDispatcher().handleGeneralKeys(e);
        break;

        // process input
      case KeyEvent.VK_C:
        if (Application.isControlDown(e)) // workaround for MAC_OS
        {
          ctrlC = true;
        }

        break;

      case KeyEvent.VK_ESCAPE:
        if (!handleEscapeKey) {
          break;
        }

        Component comp = SwingUtilities.getRoot(this);
        if (comp instanceof JDialog) {
          ((JDialog) comp).setVisible(false);
          return;
        }

        setText(null);
        break;

      case KeyEvent.VK_LEFT_PARENTHESIS:
        break;

      case KeyEvent.VK_UP:
        if (!handleEscapeKey) {
          break;
        }
        if (historyPopup == null) {
          String text = getPreviousInput();
          if (text != null) setText(text);
        } else if (!historyPopup.isDownPopup()) {
          historyPopup.showPopup();
        }
        break;

      case KeyEvent.VK_DOWN:
        if (!handleEscapeKey) {
          break;
        }
        if (historyPopup != null && historyPopup.isDownPopup()) historyPopup.showPopup();
        else setText(getNextInput());
        break;

      case KeyEvent.VK_F9:
        // needed for applets
        if (app.isApplet()) app.getGlobalKeyDispatcher().handleGeneralKeys(e);
        break;

      case KeyEvent.VK_RIGHT:
        if (moveToNextArgument(false)) {
          e.consume();
        }
        break;

      case KeyEvent.VK_TAB:
        if (moveToNextArgument(true)) {
          e.consume();
        }
        break;

      case KeyEvent.VK_F1:
        if (autoComplete) {
          if (getText().equals("")) {

            Object[] options = {app.getPlain("OK"), app.getPlain("ShowOnlineHelp")};
            int n =
                JOptionPane.showOptionDialog(
                    app.getMainComponent(),
                    app.getPlain("InputFieldHelp"),
                    app.getPlain("ApplicationName") + " - " + app.getMenu("Help"),
                    JOptionPane.YES_NO_OPTION,
                    JOptionPane.QUESTION_MESSAGE,
                    null, // do not use a custom Icon
                    options, // the titles of buttons
                    options[0]); // default button title

            if (n == 1) app.getGuiManager().openHelp(Application.WIKI_MANUAL);

          } else {
            int pos = getCaretPosition();
            while (pos > 0 && getText().charAt(pos - 1) == '[') {
              pos--;
            }
            String word = getWordAtPos(getText(), pos);
            String lowerCurWord = word.toLowerCase();
            String closest = dict.lookup(lowerCurWord);

            if (closest != null) // && lowerCurWord.equals(closest.toLowerCase()))		
            showCommandHelp(app.getInternalCommand(closest));
            else app.getGuiManager().openHelp(Application.WIKI_MANUAL);
          }
        } else app.getGuiManager().openHelp(Application.WIKI_MANUAL);

        e.consume();
        break;
      default:
    }
  }