function diff_main(text1, text2, cursor_pos, _fix_unicode) {
   // Check for equality
   if (text1 === text2) {
     if (text1) {
       return [[DIFF_EQUAL, text1]];
     }
     return [];
   }
 
   if (cursor_pos != null) {
     var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);
     if (editdiff) {
       return editdiff;
     }
   }
 
   // Trim off common prefix (speedup).
   var commonlength = diff_commonPrefix(text1, text2);
   var commonprefix = text1.substring(0, commonlength);
   text1 = text1.substring(commonlength);
   text2 = text2.substring(commonlength);
 
   // Trim off common suffix (speedup).
   commonlength = diff_commonSuffix(text1, text2);
   var commonsuffix = text1.substring(text1.length - commonlength);
   text1 = text1.substring(0, text1.length - commonlength);
   text2 = text2.substring(0, text2.length - commonlength);
 
   // Compute the diff on the middle block.
   var diffs = diff_compute_(text1, text2);
 
   // Restore the prefix and suffix.
   if (commonprefix) {
     diffs.unshift([DIFF_EQUAL, commonprefix]);
   }
   if (commonsuffix) {
     diffs.push([DIFF_EQUAL, commonsuffix]);
   }
   diff_cleanupMerge(diffs, _fix_unicode);
   return diffs;
 }
Find the differences between two texts.  Simplifies the problem by stripping
any common prefix or suffix off the texts before diffing.
@param {string} text1 Old string to be diffed.
@param {string} text2 New string to be diffed.
@param {Int|Object} [cursor_pos] Edit position in text1 or object with more info
@return {Array} Array of diff tuples.