code: public void performCompletion(String s) {
          int selStart = getSelectionStart();
          int selEnd = getSelectionEnd();
          if (selStart != selEnd)
              return;
          Editable text = getText();
          HintSpan[] spans = text.getSpans(0, length(), HintSpan.class);
          if (spans.length > 1)
              throw new IllegalStateException("more than one HintSpan");
          Word word = getCurrentWord();
          if (word == null)
              throw new IllegalStateException("no word to complete");
          autoCompleting = true;
          //for (HintSpan span : spans)
          //    text.delete(text.getSpanStart(span), text.getSpanEnd(span));
          text.delete(selStart, selStart + word.postCursor.length());
          text.delete(selStart - word.preCursor.length(), selStart);
          text.insert(selStart - word.preCursor.length(), s);
          setSelection(selStart - word.preCursor.length() + s.length());
          fireOnFilterEvent(null);
          super.setImeOptions(prevOptions);
          autoCompleting = false;
      }
docs: Replaces the current word with s. Used by Adapter to set the selected item as text.
  
  @param s text to replace with