To: vim_dev@googlegroups.com
Subject: Patch 7.3.888
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.888
Problem: Filename completion with 'fileignorecase' does not work for
multi-byte characters.
Solution: Make 'fileignorecase' work properly. (Hirohito Higashi)
Files: src/misc2.c
*** ../vim-7.3.887/src/misc2.c 2013-03-19 18:31:45.000000000 +0100
--- src/misc2.c 2013-04-12 14:15:03.000000000 +0200
***************
*** 6099,6150 ****
int maxlen;
{
int i;
const char *s = NULL;
! for (i = 0; maxlen < 0 || i < maxlen; ++i)
{
/* End of "p": check if "q" also ends or just has a slash. */
! if (p[i] == NUL)
{
! if (q[i] == NUL) /* full match */
return 0;
s = q;
break;
}
/* End of "q": check if "p" just has a slash. */
! if (q[i] == NUL)
{
s = p;
break;
}
! if ((p_fic ? TOUPPER_LOC(p[i]) != TOUPPER_LOC(q[i]) : p[i] != q[i])
#ifdef BACKSLASH_IN_FILENAME
/* consider '/' and '\\' to be equal */
! && !((p[i] == '/' && q[i] == '\\')
! || (p[i] == '\\' && q[i] == '/'))
#endif
)
{
! if (vim_ispathsep(p[i]))
return -1;
! if (vim_ispathsep(q[i]))
return 1;
! return ((char_u *)p)[i] - ((char_u *)q)[i]; /* no match */
}
}
if (s == NULL) /* "i" ran into "maxlen" */
return 0;
/* ignore a trailing slash, but not "//" or ":/" */
! if (s[i + 1] == NUL
&& i > 0
&& !after_pathsep((char_u *)s, (char_u *)s + i)
#ifdef BACKSLASH_IN_FILENAME
! && (s[i] == '/' || s[i] == '\\')
#else
! && s[i] == '/'
#endif
)
return 0; /* match with trailing slash */
--- 6099,6157 ----
int maxlen;
{
int i;
+ int c1, c2;
const char *s = NULL;
! for (i = 0; maxlen < 0 || i < maxlen; i += MB_PTR2LEN((char_u *)p + i))
{
+ c1 = PTR2CHAR((char_u *)p + i);
+ c2 = PTR2CHAR((char_u *)q + i);
+
/* End of "p": check if "q" also ends or just has a slash. */
! if (c1 == NUL)
{
! if (c2 == NUL) /* full match */
return 0;
s = q;
break;
}
/* End of "q": check if "p" just has a slash. */
! if (c2 == NUL)
{
s = p;
break;
}
! if ((p_fic ? MB_TOUPPER(c1) != MB_TOUPPER(c2) : c1 != c2)
#ifdef BACKSLASH_IN_FILENAME
/* consider '/' and '\\' to be equal */
! && !((c1 == '/' && c2 == '\\')
! || (c1 == '\\' && c2 == '/'))
#endif
)
{
! if (vim_ispathsep(c1))
return -1;
! if (vim_ispathsep(c2))
return 1;
! return p_fic ? MB_TOUPPER(c1) - MB_TOUPPER(c2)
! : c1 - c2; /* no match */
}
}
if (s == NULL) /* "i" ran into "maxlen" */
return 0;
+ c1 = PTR2CHAR((char_u *)s + i);
+ c2 = PTR2CHAR((char_u *)s + i + MB_PTR2LEN((char_u *)s + i));
/* ignore a trailing slash, but not "//" or ":/" */
! if (c2 == NUL
&& i > 0
&& !after_pathsep((char_u *)s, (char_u *)s + i)
#ifdef BACKSLASH_IN_FILENAME
! && (c1 == '/' || c1 == '\\')
#else
! && c1 == '/'
#endif
)
return 0; /* match with trailing slash */
*** ../vim-7.3.887/src/version.c 2013-04-12 13:44:49.000000000 +0200
--- src/version.c 2013-04-12 14:10:41.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 888,
/**/
--
hundred-and-one symptoms of being an internet addict:
155. You forget to eat because you're too busy surfing the net.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///