To: vim_dev@googlegroups.com Subject: Patch 7.3.873 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.3.873 Problem: Cannot easily use :s to make title case. Solution: Have "\L\u" result in title case. (James McCoy) Files: src/regexp.c, src/testdir/test79.in, src/testdir/test79.ok, src/testdir/test80.in, src/testdir/test80.ok *** ../vim-7.3.872/src/regexp.c 2013-02-26 18:45:49.000000000 +0100 --- src/regexp.c 2013-03-19 17:35:39.000000000 +0100 *************** *** 7185,7191 **** int c; int cc; int no = -1; ! fptr_T func = (fptr_T)NULL; linenr_T clnum = 0; /* init for GCC */ int len = 0; /* init for GCC */ #ifdef FEAT_EVAL --- 7185,7192 ---- int c; int cc; int no = -1; ! 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,7333 **** { switch (*src++) { ! case 'u': func = (fptr_T)do_upper; continue; ! case 'U': func = (fptr_T)do_Upper; continue; ! case 'l': func = (fptr_T)do_lower; continue; ! case 'L': func = (fptr_T)do_Lower; continue; case 'e': ! case 'E': func = (fptr_T)NULL; continue; } } --- 7319,7334 ---- { switch (*src++) { ! case 'u': func_one = (fptr_T)do_upper; continue; ! case 'U': func_all = (fptr_T)do_Upper; continue; ! case 'l': func_one = (fptr_T)do_lower; continue; ! case 'L': func_all = (fptr_T)do_Lower; continue; case 'e': ! case 'E': func_one = func_all = (fptr_T)NULL; continue; } } *************** *** 7380,7390 **** #endif /* Write to buffer, if copy is set. */ ! if (func == (fptr_T)NULL) /* just copy */ ! cc = c; ! else /* Turbo C complains without the typecast */ ! func = (fptr_T)(func(&cc, c)); #ifdef FEAT_MBYTE if (has_mbyte) --- 7381,7394 ---- #endif /* Write to buffer, if copy is set. */ ! 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; #ifdef FEAT_MBYTE if (has_mbyte) *************** *** 7495,7505 **** #endif c = *s; ! if (func == (fptr_T)NULL) /* just copy */ ! cc = c; ! else /* Turbo C complains without the typecast */ ! func = (fptr_T)(func(&cc, c)); #ifdef FEAT_MBYTE if (has_mbyte) --- 7499,7512 ---- #endif c = *s; ! 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; #ifdef FEAT_MBYTE if (has_mbyte) *** ../vim-7.3.872/src/testdir/test79.in 2013-01-30 18:21:48.000000000 +0100 --- src/testdir/test79.in 2013-03-19 17:30:51.000000000 +0100 *************** *** 32,37 **** --- 32,39 ---- j:s/R/\\/ j:s/S/\c/ j:s/T// + j:s/U/\L\uuUu\l\EU/ + j:s/V/\U\lVvV\u\Ev/ ENDTEST TEST_1: *************** *** 55,60 **** --- 57,64 ---- rRr sSs tTt + U + V STARTTEST :set nomagic *************** *** 80,85 **** --- 84,91 ---- j:s/R/\\/ j:s/S/\c/ j:s/T// + j:s/U/\L\uuUu\l\EU/ + j:s/V/\U\lVvV\u\Ev/ ENDTEST TEST_2: *************** *** 103,108 **** --- 109,116 ---- rRr sSs tTt + U + V STARTTEST :set magic& *** ../vim-7.3.872/src/testdir/test79.ok 2013-01-30 18:21:48.000000000 +0100 --- src/testdir/test79.ok 2013-03-19 17:30:51.000000000 +0100 *************** *** 24,29 **** --- 24,31 ---- r\r scs tt + UuuU + vVVv TEST_2: *************** *** 49,54 **** --- 51,58 ---- r\r scs tt + UuuU + vVVv TEST_3: *** ../vim-7.3.872/src/testdir/test80.in 2013-02-06 18:23:58.000000000 +0100 --- src/testdir/test80.in 2013-03-19 17:30:51.000000000 +0100 *************** *** 35,40 **** --- 35,42 ---- :$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,72 **** --- 69,76 ---- :$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 *** ../vim-7.3.872/src/testdir/test80.ok 2013-02-06 18:23:58.000000000 +0100 --- src/testdir/test80.ok 2013-03-19 17:31:45.000000000 +0100 *************** *** 27,32 **** --- 27,34 ---- vv w\w x x + YyyY + zZZz TEST_2: *************** *** 55,60 **** --- 57,64 ---- u vv w\w + XxxX + yYYy TEST_3: *** ../vim-7.3.872/src/version.c 2013-03-19 16:46:59.000000000 +0100 --- src/version.c 2013-03-19 17:41:08.000000000 +0100 *************** *** 730,731 **** --- 730,733 ---- { /* Add new patch number below this line */ + /**/ + 873, /**/ -- hundred-and-one symptoms of being an internet addict: 78. You find yourself dialing IP numbers on the phone. /// 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 ///