private void commitText(@NotNull InputConnection ic, @Nullable CharSequence text, int position) {
   ic.commitText(text, position);
   if (!Strings.isEmpty(text)) {
     history.addState(
         new KeyboardInputHistoryState(AndroidKeyboardUtils.getTextFromInputConnection(ic), 0));
   }
 }
 @Override
 public void handleCopy() {
   final InputConnection ic = getCurrentInputConnection();
   AndroidKeyboardUtils.copyTextFromInputConnection(ic, inputMethodService);
 }