0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

updated for version 7.3.873

Problem:    Cannot easily use :s to make title case.
Solution:   Have "\L\u" result in title case. (James McCoy)
This commit is contained in:
Bram Moolenaar
2013-03-19 17:42:15 +01:00
parent 71afbfe6cd
commit c2c355df6f
6 changed files with 31 additions and 14 deletions

View File

@@ -7185,7 +7185,8 @@ vim_regsub_both(source, dest, copy, magic, backslash)
int c; int c;
int cc; int cc;
int no = -1; int no = -1;
fptr_T func = (fptr_T)NULL; fptr_T func_all = (fptr_T)NULL;
fptr_T func_one = (fptr_T)NULL;
linenr_T clnum = 0; /* init for GCC */ linenr_T clnum = 0; /* init for GCC */
int len = 0; /* init for GCC */ int len = 0; /* init for GCC */
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
@@ -7318,16 +7319,16 @@ vim_regsub_both(source, dest, copy, magic, backslash)
{ {
switch (*src++) switch (*src++)
{ {
case 'u': func = (fptr_T)do_upper; case 'u': func_one = (fptr_T)do_upper;
continue; continue;
case 'U': func = (fptr_T)do_Upper; case 'U': func_all = (fptr_T)do_Upper;
continue; continue;
case 'l': func = (fptr_T)do_lower; case 'l': func_one = (fptr_T)do_lower;
continue; continue;
case 'L': func = (fptr_T)do_Lower; case 'L': func_all = (fptr_T)do_Lower;
continue; continue;
case 'e': case 'e':
case 'E': func = (fptr_T)NULL; case 'E': func_one = func_all = (fptr_T)NULL;
continue; continue;
} }
} }
@@ -7380,11 +7381,14 @@ vim_regsub_both(source, dest, copy, magic, backslash)
#endif #endif
/* Write to buffer, if copy is set. */ /* Write to buffer, if copy is set. */
if (func == (fptr_T)NULL) /* just copy */ if (func_one != (fptr_T)NULL)
cc = c;
else
/* Turbo C complains without the typecast */ /* Turbo C complains without the typecast */
func = (fptr_T)(func(&cc, c)); func_one = (fptr_T)(func_one(&cc, c));
else if (func_all != (fptr_T)NULL)
/* Turbo C complains without the typecast */
func_all = (fptr_T)(func_all(&cc, c));
else /* just copy */
cc = c;
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (has_mbyte) if (has_mbyte)
@@ -7495,11 +7499,14 @@ vim_regsub_both(source, dest, copy, magic, backslash)
#endif #endif
c = *s; c = *s;
if (func == (fptr_T)NULL) /* just copy */ if (func_one != (fptr_T)NULL)
cc = c;
else
/* Turbo C complains without the typecast */ /* Turbo C complains without the typecast */
func = (fptr_T)(func(&cc, c)); func_one = (fptr_T)(func_one(&cc, c));
else if (func_all != (fptr_T)NULL)
/* Turbo C complains without the typecast */
func_all = (fptr_T)(func_all(&cc, c));
else /* just copy */
cc = c;
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (has_mbyte) if (has_mbyte)

Binary file not shown.

Binary file not shown.

View File

@@ -35,6 +35,8 @@ STARTTEST
:$put =substitute('sSs', 'S', '\c', '') :$put =substitute('sSs', 'S', '\c', '')
:$put =substitute('uUu', 'U', \"\n\", '') :$put =substitute('uUu', 'U', \"\n\", '')
:$put =substitute('vVv', 'V', \"\b\", '') :$put =substitute('vVv', 'V', \"\b\", '')
:$put =substitute('wWw', 'W', \"\\\", '')
:$put =substitute('xXx', 'X', \"\r\", '')
:$put =substitute('Y', 'Y', '\L\uyYy\l\EY', '') :$put =substitute('Y', 'Y', '\L\uyYy\l\EY', '')
:$put =substitute('Z', 'Z', '\U\lZzZ\u\Ez', '') :$put =substitute('Z', 'Z', '\U\lZzZ\u\Ez', '')
/^TEST_2 /^TEST_2
@@ -67,6 +69,8 @@ STARTTEST
:$put =substitute('qQq', 'Q', '\t', '') :$put =substitute('qQq', 'Q', '\t', '')
:$put =substitute('rRr', 'R', '\\', '') :$put =substitute('rRr', 'R', '\\', '')
:$put =substitute('sSs', 'S', '\c', '') :$put =substitute('sSs', 'S', '\c', '')
:$put =substitute('tTt', 'T', \"\r\", '')
:$put =substitute('uUu', 'U', \"\n\", '')
:$put =substitute('vVv', 'V', \"\b\", '') :$put =substitute('vVv', 'V', \"\b\", '')
:$put =substitute('wWw', 'W', \"\\\", '') :$put =substitute('wWw', 'W', \"\\\", '')
:$put =substitute('X', 'X', '\L\uxXx\l\EX', '') :$put =substitute('X', 'X', '\L\uxXx\l\EX', '')

View File

@@ -27,6 +27,8 @@ u
scs scs
u u
u u
vv
w\w
x x
x x
YyyY YyyY
@@ -55,6 +57,8 @@ u
o o
pp pp
q q q q
r\r
scs
t t
t t
u u

View File

@@ -728,6 +728,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
873,
/**/ /**/
872, 872,
/**/ /**/