Hi Bram,

This new function diff_equal_char() can be used as well in diff_cmp() to make 
it simplify.

--- diff1037.c  2017-09-03 10:51:22.509283300 +0900
+++ diff.c      2017-09-03 11:56:39.251853500 +0900
@@ -51,6 +51,7 @@
 static void diff_read(int idx_orig, int idx_new, char_u *fname);
 static void diff_copy_entry(diff_T *dprev, diff_T *dp, int idx_orig, int 
idx_new);
 static diff_T *diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp);
+static int diff_equal_char(char_u *p1, char_u *p2, int *len);
 
 #ifndef USE_CR
 # define tag_fgets vim_fgets
@@ -1689,30 +1690,10 @@
        }
        else
        {
-#ifdef FEAT_MBYTE
-           l  = (*mb_ptr2len)(p1);
-           if (l != (*mb_ptr2len)(p2))
+           if (!diff_equal_char(p1, p2, &l))
                break;
-           if (l > 1)
-           {
-               if (STRNCMP(p1, p2, l) != 0
-                       && (!enc_utf8
-                           || !(diff_flags & DIFF_ICASE)
-                           || utf_fold(utf_ptr2char(p1))
-                                              != utf_fold(utf_ptr2char(p2))))
-                   break;
-               p1 += l;
-               p2 += l;
-           }
-           else
-#endif
-           {
-               if (*p1 != *p2 && (!(diff_flags & DIFF_ICASE)
-                                    || TOLOWER_LOC(*p1) != TOLOWER_LOC(*p2)))
-                   break;
-               ++p1;
-               ++p2;
-           }
+           p1 += l;
+           p2 += l;
        }
     }

Regards,
Rick

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui