def diff_lineMode(self, text1, text2, deadline):
    """Do a quick line-level diff on both strings, then rediff the parts for
      greater accuracy.
      This speedup can produce non-minimal diffs.

    Args:
      text1: Old string to be diffed.
      text2: New string to be diffed.
      deadline: Time when the diff should be complete by.

    Returns:
      Array of changes.
    """

    # Scan the text on a line-by-line basis first.
    (text1, text2, linearray) = self.diff_linesToChars(text1, text2)

    diffs = self.diff_main(text1, text2, False, deadline)

    # Convert the diff back to original text.
    self.diff_charsToLines(diffs, linearray)
    # Eliminate freak matches (e.g. blank lines)
    self.diff_cleanupSemantic(diffs)

    # Rediff any replacement blocks, this time character-by-character.
    # Add a dummy entry at the end.
    diffs.append((self.DIFF_EQUAL, ''))
    pointer = 0
    count_delete = 0
    count_insert = 0
    text_delete = ''
    text_insert = ''
    while pointer < len(diffs):
      if diffs[pointer][0] == self.DIFF_INSERT:
        count_insert += 1
        text_insert += diffs[pointer][1]
      elif diffs[pointer][0] == self.DIFF_DELETE:
        count_delete += 1
        text_delete += diffs[pointer][1]
      elif diffs[pointer][0] == self.DIFF_EQUAL:
        # Upon reaching an equality, check for prior redundancies.
        if count_delete >= 1 and count_insert >= 1:
          # Delete the offending records and add the merged ones.
          a = self.diff_main(text_delete, text_insert, False, deadline)
          diffs[pointer - count_delete - count_insert : pointer] = a
          pointer = pointer - count_delete - count_insert + len(a)
        count_insert = 0
        count_delete = 0
        text_delete = ''
        text_insert = ''

      pointer += 1

    diffs.pop()  # Remove the dummy entry at the end.

    return diffs
dataset/ETHPy150Open JT5D/Alfred-Popclip-Sublime/Sublime Text 2/JsFormat/libs/diff_match_patch/python2/diff_match_patch.py/diff_match_patch.diff_lineMode/original