Mercurial > vim
changeset 4244:7faeece39228 v7.3.873
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)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 19 Mar 2013 17:42:15 +0100 |
parents | c2bf5b221b1d |
children | 89a3d151688c |
files | src/regexp.c src/testdir/test79.in src/testdir/test79.ok src/testdir/test80.in src/testdir/test80.ok src/version.c |
diffstat | 6 files changed, 31 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/regexp.c +++ b/src/regexp.c @@ -7185,7 +7185,8 @@ vim_regsub_both(source, dest, copy, magi int c; int cc; 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 */ int len = 0; /* init for GCC */ #ifdef FEAT_EVAL @@ -7318,16 +7319,16 @@ vim_regsub_both(source, dest, copy, magi { switch (*src++) { - case 'u': func = (fptr_T)do_upper; + case 'u': func_one = (fptr_T)do_upper; continue; - case 'U': func = (fptr_T)do_Upper; + case 'U': func_all = (fptr_T)do_Upper; continue; - case 'l': func = (fptr_T)do_lower; + case 'l': func_one = (fptr_T)do_lower; continue; - case 'L': func = (fptr_T)do_Lower; + case 'L': func_all = (fptr_T)do_Lower; continue; case 'e': - case 'E': func = (fptr_T)NULL; + case 'E': func_one = func_all = (fptr_T)NULL; continue; } } @@ -7380,11 +7381,14 @@ vim_regsub_both(source, dest, copy, magi #endif /* Write to buffer, if copy is set. */ - if (func == (fptr_T)NULL) /* just copy */ + if (func_one != (fptr_T)NULL) + /* Turbo C complains without the typecast */ + 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; - else - /* Turbo C complains without the typecast */ - func = (fptr_T)(func(&cc, c)); #ifdef FEAT_MBYTE if (has_mbyte) @@ -7495,11 +7499,14 @@ vim_regsub_both(source, dest, copy, magi #endif c = *s; - if (func == (fptr_T)NULL) /* just copy */ + if (func_one != (fptr_T)NULL) + /* Turbo C complains without the typecast */ + 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; - else - /* Turbo C complains without the typecast */ - func = (fptr_T)(func(&cc, c)); #ifdef FEAT_MBYTE if (has_mbyte)
index f83b6b6e2265fe6f2581e015e3e0e94c01ed3fa6..c50b92fa4c9e2cd900219a52f85e1a767f9ba00b GIT binary patch literal 2663 zc%1E4NpIRf6z2S-Tyu7#1P7XU!k$oZU@?0Zz;Nj+l`&=s#wK3Up8DHsGuU{7BEzA# z3TgCxGvAx#eV)fis%3LC!{m~dGr2X@jV3GVt+i2=rK}}6S)Z~a>hF!ITGrCglboS* zMR&}ym$qZ80!aQ`Zs%IImBn>}(S#+*qIGpR0}P~cUy{Uu1Vzi>thKCZ!uxU!;!|zg z3w_mcG~42g8E3n56;eeuNVU1OJYOmlDjOpXWbBO*cr99_OyY5hDg<|^iq`@rj%^6u z;RD`d0rQx{EM_o`DLPS&Oeqk_9}4OOcc?+ona?S15*#j2Tu{~`sI^)Yw+VLJD7Go< zxVjapE6Td${EVVUf+j^z1pUruf;vSn1Sb^r2-+0&2_i)Uf(k_vIge2^beBcP89Jz; zIHY|ecX8B4?;~_jd?$Mcy!NM?_A*qUno4J~xqRXN0cs#Z9U9Pt7PO%QT33Vh;~MlQ z9gJrKHZL1^>%D>5H^CZMU`sX(VRYc0Zk*~LuKzoDx`XL|=HS-9_@@S9iAO&0&?P>r zdhGm+_pR{80xD8z!0TIX@_{#QXp9fs@j`vt+J*YOz2!O|SX8<|^TM~tWBSF%Y-Nfd zmt~k#CZJRmnAWDCiYm<NGnhB#uxKt|*;>MD`xRE5)i!k}r)6IVuY&@5m$>10fp;79 z8a}a4T!fs_S0nXqVng~`^!#jqc*KU-h<bE{8P+$Vj}Qy%n@1dh31}U21SX;#9ifNy zohZHc9ftJXXua<1+0QlmuRqrl3vMa2cTU*94;~nH&#(f+@(jx{EX%MA!_o{(9b_u! zmce}q{3Hqf(fwq6E%~=r_V44>e)P8FUpmFVO;;b6&F`wOTXauLyuc=NxBNjb8TT&1 z`~UbpM*T;R9TqNThB1-NgDO{WcXj6OD^`J?`wQ=EPR0Qv!VMYkBFPkrsc&SwdzX=$ Q%U^F_wofy`aO`0Izn(?os{jB1
index 31ad3a41e46912727705358d815ae596c8a19a7a..bb30d140525facb55d0b400578271a9d90da5534 GIT binary patch literal 421 zc$}?}yKcfj5Jf4IBjq1x;@)p?2T_z)l?13pion=_AvSo|lze*zVpmDJ=rpU@z2|E7 zEi=u|ntqk{ZDwrjCcxzWee$8F(Flh-*YkrgiU-5tAdbSo_gt3BiH8-BYc@|5&%A8e zDW6JtQ&ROR_E&oj*9U5;F{#1!EYqf$a-7YMU5l6CIE?>jIsH?MpD>p>3y}q>vJ{nP zB4p%J=d6^qpfx(%P)J#@<-4p^1f8NaTm<JlZTylxhxw5W^(%kbuf2`btfbs_lUUy? IW93!h3&>++q5uE@
--- a/src/testdir/test80.in +++ b/src/testdir/test80.in @@ -35,6 +35,8 @@ STARTTEST :$put =substitute('vVv', 'V', \"\b\", '') :$put =substitute('wWw', 'W', \"\\\", '') :$put =substitute('xXx', 'X', \"\r\", '') +:$put =substitute('Y', 'Y', '\L\uyYy\l\EY', '') +:$put =substitute('Z', 'Z', '\U\lZzZ\u\Ez', '') /^TEST_2 ENDTEST @@ -67,6 +69,8 @@ STARTTEST :$put =substitute('uUu', 'U', \"\n\", '') :$put =substitute('vVv', 'V', \"\b\", '') :$put =substitute('wWw', 'W', \"\\\", '') +:$put =substitute('X', 'X', '\L\uxXx\l\EX', '') +:$put =substitute('Y', 'Y', '\U\lYyY\u\Ey', '') /^TEST_3 ENDTEST