public AutoCompleteTextField(
      int columns, Application app, boolean handleEscapeKey, AutoCompleteDictionary dict) {
    super(app);
    // allow dynamic width with columns = -1
    if (columns > 0) setColumns(columns);

    this.app = app;
    setAutoComplete(true);
    this.handleEscapeKey = handleEscapeKey;
    curWord = new StringBuilder();

    historyIndex = 0;
    history = new ArrayList<String>(50);

    completions = null;

    CommandCompletionListCellRenderer cellRenderer = new CommandCompletionListCellRenderer();
    completionsPopup = new CompletionsPopup(this, cellRenderer, 6);
    // addKeyListener(this); now in MathTextField
    setDictionary(dict);
  }