String deletion = prevDiff.text; String insertion = thisDiff.text; int overlap_length1 = diffCommonOverlap(deletion, insertion); int overlap_length2 = diffCommonOverlap(insertion, deletion); if (overlap_length1 >= overlap_length2) { if (overlap_length1 >= deletion.length() / 2.0 ||