Merge pull request #4213 from jbradaric/vim-7.4.835

vim-patch:7.4.{835,843,877}
This commit is contained in:
Justin M. Keyes 2016-02-17 03:49:57 -05:00
commit 5f54519b4f
3 changed files with 43 additions and 34 deletions

View File

@ -1046,41 +1046,44 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_l
return retptr; return retptr;
} }
/* // Check if two wildcard paths are equal.
* check if two wildcard paths are equal. Returns TRUE or FALSE. // They are equal if:
* They are equal if: // - both paths are NULL
* - both paths are NULL // - they have the same length
* - they have the same length // - char by char comparison is OK
* - char by char comparison is OK // - the only differences are in the counters behind a '**', so
* - the only differences are in the counters behind a '**', so // '**\20' is equal to '**\24'
* '**\20' is equal to '**\24' static bool ff_wc_equal(char_u *s1, char_u *s2)
*/
static int ff_wc_equal(char_u *s1, char_u *s2)
{ {
int i; int i, j;
int c1 = NUL;
int c2 = NUL;
int prev1 = NUL; int prev1 = NUL;
int prev2 = NUL; int prev2 = NUL;
if (s1 == s2) if (s1 == s2) {
return TRUE; return true;
}
if (s1 == NULL || s2 == NULL) if (s1 == NULL || s2 == NULL) {
return FALSE; return false;
}
if (STRLEN(s1) != STRLEN(s2)) for (i = 0, j = 0; s1[i] != NUL && s2[j] != NUL;) {
return FAIL; c1 = PTR2CHAR(s1 + i);
c2 = PTR2CHAR(s2 + j);
for (i = 0; s1[i] != NUL && s2[i] != NUL; i += MB_PTR2LEN(s1 + i)) {
int c1 = PTR2CHAR(s1 + i);
int c2 = PTR2CHAR(s2 + i);
if ((p_fic ? vim_tolower(c1) != vim_tolower(c2) : c1 != c2) if ((p_fic ? vim_tolower(c1) != vim_tolower(c2) : c1 != c2)
&& (prev1 != '*' || prev2 != '*')) && (prev1 != '*' || prev2 != '*')) {
return FAIL; return false;
}
prev2 = prev1; prev2 = prev1;
prev1 = c1; prev1 = c1;
i += MB_PTR2LEN(s1 + i);
j += MB_PTR2LEN(s2 + j);
} }
return TRUE; return s1[i] == s2[j];
} }
/* /*
@ -1111,10 +1114,11 @@ static int ff_check_visited(ff_visited_T **visited_list, char_u *fname, char_u *
if ((url && fnamecmp(vp->ffv_fname, ff_expand_buffer) == 0) if ((url && fnamecmp(vp->ffv_fname, ff_expand_buffer) == 0)
|| (!url && vp->file_id_valid || (!url && vp->file_id_valid
&& os_fileid_equal(&(vp->file_id), &file_id))) { && os_fileid_equal(&(vp->file_id), &file_id))) {
/* are the wildcard parts equal */ // are the wildcard parts equal
if (ff_wc_equal(vp->ffv_wc_path, wc_path) == TRUE) if (ff_wc_equal(vp->ffv_wc_path, wc_path)) {
/* already visited */ // already visited
return FAIL; return FAIL;
}
} }
} }

View File

@ -1775,19 +1775,20 @@ bool same_directory(char_u *f1, char_u *f2)
*/ */
int pathcmp(const char *p, const char *q, int maxlen) int pathcmp(const char *p, const char *q, int maxlen)
{ {
int i; int i, j;
int c1, c2; int c1, c2;
const char *s = NULL; const char *s = NULL;
for (i = 0; maxlen < 0 || i < maxlen; i += MB_PTR2LEN((char_u *)p + i)) { for (i = 0, j = 0; maxlen < 0 || (i < maxlen && j < maxlen);) {
c1 = PTR2CHAR((char_u *)p + i); c1 = PTR2CHAR((char_u *)p + i);
c2 = PTR2CHAR((char_u *)q + i); c2 = PTR2CHAR((char_u *)q + j);
/* End of "p": check if "q" also ends or just has a slash. */ /* End of "p": check if "q" also ends or just has a slash. */
if (c1 == NUL) { if (c1 == NUL) {
if (c2 == NUL) /* full match */ if (c2 == NUL) /* full match */
return 0; return 0;
s = q; s = q;
i = j;
break; break;
} }
@ -1811,9 +1812,13 @@ int pathcmp(const char *p, const char *q, int maxlen)
return p_fic ? vim_toupper(c1) - vim_toupper(c2) return p_fic ? vim_toupper(c1) - vim_toupper(c2)
: c1 - c2; /* no match */ : c1 - c2; /* no match */
} }
i += MB_PTR2LEN((char_u *)p + i);
j += MB_PTR2LEN((char_u *)q + j);
} }
if (s == NULL) /* "i" ran into "maxlen" */ if (s == NULL) { // "i" or "j" ran into "maxlen"
return 0; return 0;
}
c1 = PTR2CHAR((char_u *)s + i); c1 = PTR2CHAR((char_u *)s + i);
c2 = PTR2CHAR((char_u *)s + i + MB_PTR2LEN((char_u *)s + i)); c2 = PTR2CHAR((char_u *)s + i + MB_PTR2LEN((char_u *)s + i));

View File

@ -411,7 +411,7 @@ static int included_patches[] = {
// 880 NA // 880 NA
// 879, // 879,
// 878, // 878,
// 877, 877,
// 876 NA // 876 NA
// 875 NA // 875 NA
// 874 NA // 874 NA
@ -445,7 +445,7 @@ static int included_patches[] = {
// 846 NA // 846 NA
// 845, // 845,
// 844, // 844,
// 843, 843,
// 842 NA // 842 NA
// 841 NA // 841 NA
// 840 NA // 840 NA
@ -453,7 +453,7 @@ static int included_patches[] = {
// 838 NA // 838 NA
// 837 NA // 837 NA
836, 836,
// 835, 835,
834, 834,
// 833, // 833,
// 832, // 832,