Program: 87356
Project: 87356
Buggy source:
/** 
 * Returns the text surrounding the cursor.
 * @param sortedSeparators a sorted array of code points that split words.
 * @param scriptId the script we consider to be writing words, as one of ScriptUtils.SCRIPT_
 * @return a range containing the text surrounding the cursor
 */
public TextRange getWordRangeAtCursor(final int[] sortedSeparators,final int scriptId){
  mIC=mParent.getCurrentInputConnection();
  if (mIC == null) {
    return null;
  }
  final CharSequence before=mIC.getTextBeforeCursor(Constants.EDITOR_CONTENTS_CACHE_SIZE,InputConnection.GET_TEXT_WITH_STYLES);
  final CharSequence after=mIC.getTextAfterCursor(Constants.EDITOR_CONTENTS_CACHE_SIZE,InputConnection.GET_TEXT_WITH_STYLES);
  if (before == null || after == null) {
    return null;
  }
  int startIndexInBefore=before.length();
  while (startIndexInBefore > 0) {
    final int codePoint=Character.codePointBefore(before,startIndexInBefore);
    if (isSeparator(codePoint,sortedSeparators) || !ScriptUtils.isLetterPartOfScript(codePoint,scriptId)) {
      break;
    }
    --startIndexInBefore;
    if (Character.isSupplementaryCodePoint(codePoint)) {
      --startIndexInBefore;
    }
  }
  int endIndexInAfter=-1;
  while (++endIndexInAfter < after.length()) {
    final int codePoint=Character.codePointAt(after,endIndexInAfter);
    if (isSeparator(codePoint,sortedSeparators) || !ScriptUtils.isLetterPartOfScript(codePoint,scriptId)) {
      break;
    }
    if (Character.isSupplementaryCodePoint(codePoint)) {
      ++endIndexInAfter;
    }
  }
  final boolean hasUrlSpans=SpannableStringUtils.hasUrlSpans(before,startIndexInBefore,before.length()) || SpannableStringUtils.hasUrlSpans(after,0,endIndexInAfter);
  return new TextRange(SpannableStringUtils.concatWithNonParagraphSuggestionSpansOnly(before,after),startIndexInBefore,before.length() + endIndexInAfter,before.length(),hasUrlSpans);
}

Fixed version (ground truth):
/** 
 * Returns the text surrounding the cursor.
 * @param spacingAndPunctuations the rules for spacing and punctuation
 * @param scriptId the script we consider to be writing words, as one of ScriptUtils.SCRIPT_
 * @return a range containing the text surrounding the cursor
 */
public TextRange getWordRangeAtCursor(final SpacingAndPunctuations spacingAndPunctuations,final int scriptId){
  mIC=mParent.getCurrentInputConnection();
  if (mIC == null) {
    return null;
  }
  final CharSequence before=mIC.getTextBeforeCursor(Constants.EDITOR_CONTENTS_CACHE_SIZE,InputConnection.GET_TEXT_WITH_STYLES);
  final CharSequence after=mIC.getTextAfterCursor(Constants.EDITOR_CONTENTS_CACHE_SIZE,InputConnection.GET_TEXT_WITH_STYLES);
  if (before == null || after == null) {
    return null;
  }
  int startIndexInBefore=before.length();
  while (startIndexInBefore > 0) {
    final int codePoint=Character.codePointBefore(before,startIndexInBefore);
    if (!isPartOfCompositionForScript(codePoint,spacingAndPunctuations,scriptId)) {
      break;
    }
    --startIndexInBefore;
    if (Character.isSupplementaryCodePoint(codePoint)) {
      --startIndexInBefore;
    }
  }
  int endIndexInAfter=-1;
  while (++endIndexInAfter < after.length()) {
    final int codePoint=Character.codePointAt(after,endIndexInAfter);
    if (!isPartOfCompositionForScript(codePoint,spacingAndPunctuations,scriptId)) {
      break;
    }
    if (Character.isSupplementaryCodePoint(codePoint)) {
      ++endIndexInAfter;
    }
  }
  final boolean hasUrlSpans=SpannableStringUtils.hasUrlSpans(before,startIndexInBefore,before.length()) || SpannableStringUtils.hasUrlSpans(after,0,endIndexInAfter);
  return new TextRange(SpannableStringUtils.concatWithNonParagraphSuggestionSpansOnly(before,after),startIndexInBefore,before.length() + endIndexInAfter,before.length(),hasUrlSpans);
}