@Override
  public void pickSuggestionManually(
      int index, CharSequence suggestion, boolean withAutoSpaceEnabled) {
    if (getCurrentComposedWord().isAtTagsSearchState()) {
      if (index == 0) {
        // this is a special case for tags-searcher
        // since we append a magnifying glass to the suggestions, the "suggestion"
        // value is not a valid output suggestion
        suggestion = getCurrentComposedWord().getTypedWord().toString();
      } else {
        // regular emoji. Storing in history.
        getQuickKeyHistoryRecords().store(suggestion.toString(), suggestion.toString());
      }
    }

    super.pickSuggestionManually(index, suggestion, withAutoSpaceEnabled);
  }
@Test
  public void testPickingEmojiOutputsToInput() throws Exception {
    verifyNoSuggestionsInteractions();
    mAnySoftKeyboardUnderTest.simulateTextTyping(":face");

    mAnySoftKeyboardUnderTest.pickSuggestionManually(1, "\uD83D\uDE00");

    verifySuggestions(true);
    Assert.assertEquals("\uD83D\uDE00", mAnySoftKeyboardUnderTest.getCurrentInputConnectionText());

    // deleting

    // correctly, this is a bug with TestInputConnection: it reports that there is one character
    // in the input
    // but that's because it does not support deleting multi-character emojis.
    Assert.assertEquals(2, mAnySoftKeyboardUnderTest.getCurrentInputConnectionText().length());
    mAnySoftKeyboardUnderTest.simulateKeyPress(KeyCodes.DELETE);
    // so, it was two characters, and now it's one
    Assert.assertEquals(1, mAnySoftKeyboardUnderTest.getCurrentInputConnectionText().length());
  }