# HG changeset patch # User Bram Moolenaar # Date 1363711335 -3600 # Node ID 7faeece39228fde0ac5c26a362a223d0dbe9bba5 # Parent c2bf5b221b1dcf5c22a8a871479a1213b1a8a08f 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) diff --git a/src/regexp.c b/src/regexp.c --- 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) diff --git a/src/testdir/test79.in b/src/testdir/test79.in 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#CZJRmnAWDCiYmMD`xRE5)i!k}r)6IVuY&@5m$>10fp;79 z8a}a4T!fs_S0nXqVng~`^!#jqc*KU-he)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 diff --git a/src/testdir/test79.ok b/src/testdir/test79.ok 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++q5uE@ diff --git a/src/testdir/test80.in b/src/testdir/test80.in --- 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 diff --git a/src/testdir/test80.ok b/src/testdir/test80.ok --- a/src/testdir/test80.ok +++ b/src/testdir/test80.ok @@ -27,6 +27,8 @@ u vv w\w x x +YyyY +zZZz TEST_2: @@ -55,6 +57,8 @@ u u vv w\w +XxxX +yYYy TEST_3: diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 873, +/**/ 872, /**/ 871,