Program: 88159
Project: 88159
Buggy source:
@Override public void onUpdateSelection(int oldSelStart,int oldSelEnd,int newSelStart,int newSelEnd,int candidatesStart,int candidatesEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,candidatesStart,candidatesEnd);
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ mLastSelectionStart+ "String_Node_Str"+ mLastSelectionEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ candidatesStart+ "String_Node_Str"+ candidatesEnd);
  }
  mVoiceProxy.setCursorAndSelection(newSelEnd,newSelStart);
  final boolean selectionChanged=(newSelStart != candidatesEnd || newSelEnd != candidatesEnd) && mLastSelectionStart != newSelStart;
  final boolean candidatesCleared=candidatesStart == -1 && candidatesEnd == -1;
  if (!mExpectingUpdateSelection) {
    if (((mComposingStringBuilder.length() > 0 && mHasUncommittedTypedChars) || mVoiceProxy.isVoiceInputHighlighted()) && (selectionChanged || candidatesCleared)) {
      if (candidatesCleared) {
        mRecorrection.saveRecorrectionSuggestion(mWordComposer,mComposingStringBuilder);
      }
      mComposingStringBuilder.setLength(0);
      mHasUncommittedTypedChars=false;
      if (isCursorTouchingWord()) {
        mHandler.cancelUpdateBigramPredictions();
        mHandler.postUpdateSuggestions();
      }
 else {
        setPunctuationSuggestions();
      }
      TextEntryState.reset();
      final InputConnection ic=getCurrentInputConnection();
      if (ic != null) {
        ic.finishComposingText();
      }
      mVoiceProxy.setVoiceInputHighlighted(false);
    }
 else     if (!mHasUncommittedTypedChars && TextEntryState.isAcceptedDefault()) {
      TextEntryState.reset();
    }
    mJustAddedMagicSpace=false;
    mJustReplacedDoubleSpace=false;
  }
  mExpectingUpdateSelection=false;
  mHandler.postUpdateShiftKeyState();
  mLastSelectionStart=newSelStart;
  mLastSelectionEnd=newSelEnd;
  mRecorrection.updateRecorrectionSelection(mKeyboardSwitcher,mSuggestionsView,candidatesStart,candidatesEnd,newSelStart,newSelEnd,oldSelStart,mLastSelectionStart,mLastSelectionEnd,mHasUncommittedTypedChars);
}

Fixed version (ground truth):
@Override public void onUpdateSelection(int oldSelStart,int oldSelEnd,int newSelStart,int newSelEnd,int candidatesStart,int candidatesEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,candidatesStart,candidatesEnd);
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ mLastSelectionStart+ "String_Node_Str"+ mLastSelectionEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ candidatesStart+ "String_Node_Str"+ candidatesEnd);
  }
  mVoiceProxy.setCursorAndSelection(newSelEnd,newSelStart);
  final boolean selectionChanged=(newSelStart != candidatesEnd || newSelEnd != candidatesEnd) && mLastSelectionStart != newSelStart;
  final boolean candidatesCleared=candidatesStart == -1 && candidatesEnd == -1;
  if (!mExpectingUpdateSelection) {
    if (((mComposingStringBuilder.length() > 0 && mHasUncommittedTypedChars) || mVoiceProxy.isVoiceInputHighlighted()) && (selectionChanged || candidatesCleared)) {
      if (candidatesCleared) {
        mRecorrection.saveRecorrectionSuggestion(mWordComposer,mComposingStringBuilder);
      }
      mComposingStringBuilder.setLength(0);
      mHasUncommittedTypedChars=false;
      TextEntryState.reset();
      updateSuggestions();
      final InputConnection ic=getCurrentInputConnection();
      if (ic != null) {
        ic.finishComposingText();
      }
      mVoiceProxy.setVoiceInputHighlighted(false);
    }
 else     if (!mHasUncommittedTypedChars) {
      TextEntryState.reset();
      updateSuggestions();
    }
    mJustAddedMagicSpace=false;
    mJustReplacedDoubleSpace=false;
  }
  mExpectingUpdateSelection=false;
  mHandler.postUpdateShiftKeyState();
  mLastSelectionStart=newSelStart;
  mLastSelectionEnd=newSelEnd;
  mRecorrection.updateRecorrectionSelection(mKeyboardSwitcher,mSuggestionsView,candidatesStart,candidatesEnd,newSelStart,newSelEnd,oldSelStart,mLastSelectionStart,mLastSelectionEnd,mHasUncommittedTypedChars);
}