|
Karsten Hopp |
6fe1da |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
6fe1da |
Subject: Patch 7.3.874
|
|
Karsten Hopp |
6fe1da |
Fcc: outbox
|
|
Karsten Hopp |
6fe1da |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
6fe1da |
Mime-Version: 1.0
|
|
Karsten Hopp |
6fe1da |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
6fe1da |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
6fe1da |
------------
|
|
Karsten Hopp |
6fe1da |
|
|
Karsten Hopp |
6fe1da |
Patch 7.3.874
|
|
Karsten Hopp |
6fe1da |
Problem: Comparing file names does not handle multi-byte characters
|
|
Karsten Hopp |
6fe1da |
properly.
|
|
Karsten Hopp |
6fe1da |
Solution: Implement multi-byte handling.
|
|
Karsten Hopp |
6fe1da |
Files: src/misc1.c, src/misc2.c
|
|
Karsten Hopp |
6fe1da |
|
|
Karsten Hopp |
6fe1da |
|
|
Karsten Hopp |
6fe1da |
*** ../vim-7.3.873/src/misc1.c 2013-03-19 16:46:59.000000000 +0100
|
|
Karsten Hopp |
6fe1da |
--- src/misc1.c 2013-03-19 18:30:52.000000000 +0100
|
|
Karsten Hopp |
6fe1da |
***************
|
|
Karsten Hopp |
6fe1da |
*** 5049,5068 ****
|
|
Karsten Hopp |
6fe1da |
size_t len;
|
|
Karsten Hopp |
6fe1da |
{
|
|
Karsten Hopp |
6fe1da |
#ifdef BACKSLASH_IN_FILENAME
|
|
Karsten Hopp |
6fe1da |
/* TODO: multi-byte characters. */
|
|
Karsten Hopp |
6fe1da |
! while (len > 0 && *x && *y)
|
|
Karsten Hopp |
6fe1da |
{
|
|
Karsten Hopp |
6fe1da |
! if ((p_fic ? TOLOWER_LOC(*x) != TOLOWER_LOC(*y) : *x != *y)
|
|
Karsten Hopp |
6fe1da |
! && !(*x == '/' && *y == '\\')
|
|
Karsten Hopp |
6fe1da |
! && !(*x == '\\' && *y == '/'))
|
|
Karsten Hopp |
6fe1da |
break;
|
|
Karsten Hopp |
6fe1da |
! ++x;
|
|
Karsten Hopp |
6fe1da |
! ++y;
|
|
Karsten Hopp |
6fe1da |
! --len;
|
|
Karsten Hopp |
6fe1da |
}
|
|
Karsten Hopp |
6fe1da |
if (len == 0)
|
|
Karsten Hopp |
6fe1da |
return 0;
|
|
Karsten Hopp |
6fe1da |
! return (*x - *y);
|
|
Karsten Hopp |
6fe1da |
#else
|
|
Karsten Hopp |
6fe1da |
if (p_fic)
|
|
Karsten Hopp |
6fe1da |
return MB_STRNICMP(x, y, len);
|
|
Karsten Hopp |
6fe1da |
--- 5049,5076 ----
|
|
Karsten Hopp |
6fe1da |
size_t len;
|
|
Karsten Hopp |
6fe1da |
{
|
|
Karsten Hopp |
6fe1da |
#ifdef BACKSLASH_IN_FILENAME
|
|
Karsten Hopp |
6fe1da |
+ char_u *px = x;
|
|
Karsten Hopp |
6fe1da |
+ char_u *py = y;
|
|
Karsten Hopp |
6fe1da |
+ int cx = NUL;
|
|
Karsten Hopp |
6fe1da |
+ int cy = NUL;
|
|
Karsten Hopp |
6fe1da |
+
|
|
Karsten Hopp |
6fe1da |
/* TODO: multi-byte characters. */
|
|
Karsten Hopp |
6fe1da |
! while (len > 0)
|
|
Karsten Hopp |
6fe1da |
{
|
|
Karsten Hopp |
6fe1da |
! cx = PTR2CHAR(px);
|
|
Karsten Hopp |
6fe1da |
! cy = PTR2CHAR(py);
|
|
Karsten Hopp |
6fe1da |
! if (cx == NUL || cy == NUL
|
|
Karsten Hopp |
6fe1da |
! || ((p_fic ? MB_TOLOWER(cx) != MB_TOLOWER(cy) : cx != cy)
|
|
Karsten Hopp |
6fe1da |
! && !(cx == '/' && cy == '\\')
|
|
Karsten Hopp |
6fe1da |
! && !(cx == '\\' && cy == '/')))
|
|
Karsten Hopp |
6fe1da |
break;
|
|
Karsten Hopp |
6fe1da |
! len -= MB_PTR2LEN(px);
|
|
Karsten Hopp |
6fe1da |
! px += MB_PTR2LEN(px);
|
|
Karsten Hopp |
6fe1da |
! py += MB_PTR2LEN(py);
|
|
Karsten Hopp |
6fe1da |
}
|
|
Karsten Hopp |
6fe1da |
if (len == 0)
|
|
Karsten Hopp |
6fe1da |
return 0;
|
|
Karsten Hopp |
6fe1da |
! return (cx - cy);
|
|
Karsten Hopp |
6fe1da |
#else
|
|
Karsten Hopp |
6fe1da |
if (p_fic)
|
|
Karsten Hopp |
6fe1da |
return MB_STRNICMP(x, y, len);
|
|
Karsten Hopp |
6fe1da |
*** ../vim-7.3.873/src/misc2.c 2013-03-19 16:46:59.000000000 +0100
|
|
Karsten Hopp |
6fe1da |
--- src/misc2.c 2013-03-19 18:22:29.000000000 +0100
|
|
Karsten Hopp |
6fe1da |
***************
|
|
Karsten Hopp |
6fe1da |
*** 5352,5357 ****
|
|
Karsten Hopp |
6fe1da |
--- 5352,5359 ----
|
|
Karsten Hopp |
6fe1da |
char_u *s2;
|
|
Karsten Hopp |
6fe1da |
{
|
|
Karsten Hopp |
6fe1da |
int i;
|
|
Karsten Hopp |
6fe1da |
+ int prev1 = NUL;
|
|
Karsten Hopp |
6fe1da |
+ int prev2 = NUL;
|
|
Karsten Hopp |
6fe1da |
|
|
Karsten Hopp |
6fe1da |
if (s1 == s2)
|
|
Karsten Hopp |
6fe1da |
return TRUE;
|
|
Karsten Hopp |
6fe1da |
***************
|
|
Karsten Hopp |
6fe1da |
*** 5362,5381 ****
|
|
Karsten Hopp |
6fe1da |
if (STRLEN(s1) != STRLEN(s2))
|
|
Karsten Hopp |
6fe1da |
return FAIL;
|
|
Karsten Hopp |
6fe1da |
|
|
Karsten Hopp |
6fe1da |
! /* TODO: handle multi-byte characters. */
|
|
Karsten Hopp |
6fe1da |
! for (i = 0; s1[i] != NUL && s2[i] != NUL; i++)
|
|
Karsten Hopp |
6fe1da |
{
|
|
Karsten Hopp |
6fe1da |
! if (s1[i] != s2[i]
|
|
Karsten Hopp |
6fe1da |
! && (!p_fic || TOUPPER_LOC(s1[i]) != TOUPPER_LOC(s2[i])))
|
|
Karsten Hopp |
6fe1da |
! {
|
|
Karsten Hopp |
6fe1da |
! if (i >= 2)
|
|
Karsten Hopp |
6fe1da |
! if (s1[i-1] == '*' && s1[i-2] == '*')
|
|
Karsten Hopp |
6fe1da |
! continue;
|
|
Karsten Hopp |
6fe1da |
! else
|
|
Karsten Hopp |
6fe1da |
! return FAIL;
|
|
Karsten Hopp |
6fe1da |
! else
|
|
Karsten Hopp |
6fe1da |
! return FAIL;
|
|
Karsten Hopp |
6fe1da |
! }
|
|
Karsten Hopp |
6fe1da |
}
|
|
Karsten Hopp |
6fe1da |
return TRUE;
|
|
Karsten Hopp |
6fe1da |
}
|
|
Karsten Hopp |
6fe1da |
--- 5364,5379 ----
|
|
Karsten Hopp |
6fe1da |
if (STRLEN(s1) != STRLEN(s2))
|
|
Karsten Hopp |
6fe1da |
return FAIL;
|
|
Karsten Hopp |
6fe1da |
|
|
Karsten Hopp |
6fe1da |
! for (i = 0; s1[i] != NUL && s2[i] != NUL; i += MB_PTR2LEN(s1 + i))
|
|
Karsten Hopp |
6fe1da |
{
|
|
Karsten Hopp |
6fe1da |
! int c1 = PTR2CHAR(s1 + i);
|
|
Karsten Hopp |
6fe1da |
! int c2 = PTR2CHAR(s2 + i);
|
|
Karsten Hopp |
6fe1da |
!
|
|
Karsten Hopp |
6fe1da |
! if ((p_fic ? MB_TOLOWER(c1) != MB_TOLOWER(c2) : c1 != c2)
|
|
Karsten Hopp |
6fe1da |
! && (prev1 != '*' || prev2 != '*'))
|
|
Karsten Hopp |
6fe1da |
! return FAIL;
|
|
Karsten Hopp |
6fe1da |
! prev2 = prev1;
|
|
Karsten Hopp |
6fe1da |
! prev1 = c1;
|
|
Karsten Hopp |
6fe1da |
}
|
|
Karsten Hopp |
6fe1da |
return TRUE;
|
|
Karsten Hopp |
6fe1da |
}
|
|
Karsten Hopp |
6fe1da |
*** ../vim-7.3.873/src/version.c 2013-03-19 17:42:10.000000000 +0100
|
|
Karsten Hopp |
6fe1da |
--- src/version.c 2013-03-19 18:24:57.000000000 +0100
|
|
Karsten Hopp |
6fe1da |
***************
|
|
Karsten Hopp |
6fe1da |
*** 730,731 ****
|
|
Karsten Hopp |
6fe1da |
--- 730,733 ----
|
|
Karsten Hopp |
6fe1da |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
6fe1da |
+ /**/
|
|
Karsten Hopp |
6fe1da |
+ 874,
|
|
Karsten Hopp |
6fe1da |
/**/
|
|
Karsten Hopp |
6fe1da |
|
|
Karsten Hopp |
6fe1da |
--
|
|
Karsten Hopp |
6fe1da |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
6fe1da |
80. At parties, you introduce your spouse as your "service provider."
|
|
Karsten Hopp |
6fe1da |
|
|
Karsten Hopp |
6fe1da |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
6fe1da |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
6fe1da |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
6fe1da |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|