code: function() {
      // It's possible for TAB to not change the input, in which case the
      // textChanged event will not fire, and the caret move will not be
      // processed. So we check that this is done first
      this.terminal._caretChange = Caret.TO_ARG_END;
      var inputState = this.terminal.getInputState();
      this._processCaretChange(inputState);
  
      this.terminal._previousValue = this.terminal.inputElement.value;
  
      // The changes made by complete may happen asynchronously, so after the
      // the call to complete() we should avoid making changes before the end
      // of the event loop
      var index = this.terminal.getChoiceIndex();
      return this.requisition.complete(inputState.cursor, index).then(function(updated) {
        // Abort UI changes if this UI update has been overtaken
        if (!updated) {
          return RESOLVED;
        }
        this.textChanged();
        return this.terminal.unsetChoice();
      }.bind(this));
    }
docs: Warning: We get TAB events for more than just the user pressing TAB in our
  input element.