home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.4 / 7.4.323 < prev    next >
Encoding:
Internet Message Format  |  2014-06-11  |  2.8 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.4.323
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.4.323
  11. Problem:    Substitute() with zero width pattern breaks multi-byte character.
  12. Solution:   Take multi-byte character size into account. (Yukihiro Nakadaira)
  13. Files:        src/eval.c src/testdir/test69.in, src/testdir/test69.ok
  14.  
  15.  
  16. *** ../vim-7.4.322/src/eval.c    2014-05-28 20:31:37.496292805 +0200
  17. --- src/eval.c    2014-06-12 18:34:22.928389291 +0200
  18. ***************
  19. *** 24848,24855 ****
  20.           if (zero_width == regmatch.startp[0])
  21.           {
  22.               /* avoid getting stuck on a match with an empty string */
  23. !             *((char_u *)ga.ga_data + ga.ga_len) = *tail++;
  24. !             ++ga.ga_len;
  25.               continue;
  26.           }
  27.           zero_width = regmatch.startp[0];
  28. --- 24848,24858 ----
  29.           if (zero_width == regmatch.startp[0])
  30.           {
  31.               /* avoid getting stuck on a match with an empty string */
  32. !             i = MB_PTR2LEN(tail);
  33. !             mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail,
  34. !                                    (size_t)i);
  35. !             ga.ga_len += i;
  36. !             tail += i;
  37.               continue;
  38.           }
  39.           zero_width = regmatch.startp[0];
  40. *** ../vim-7.4.322/src/testdir/test69.in    2014-02-22 23:49:30.268896843 +0100
  41. --- src/testdir/test69.in    2014-06-12 18:32:43.108385514 +0200
  42. ***************
  43. *** 180,185 ****
  44. --- 180,192 ----
  45.   byteidxcomp
  46.   
  47.   STARTTEST
  48. + /^substitute
  49. + :let y = substitute('∩╝æ∩╝Æ∩╝ô', '\zs', 'a', 'g')    | put =y
  50. + ENDTEST
  51. + substitute
  52. + STARTTEST
  53.   :g/^STARTTEST/.,/^ENDTEST/d
  54.   :1;/^Results/,$wq! test.out
  55.   ENDTEST
  56. *** ../vim-7.4.322/src/testdir/test69.ok    2014-02-22 23:49:30.268896843 +0100
  57. --- src/testdir/test69.ok    2014-06-12 18:32:43.108385514 +0200
  58. ***************
  59. *** 160,162 ****
  60. --- 160,166 ----
  61.   [0, 1, 3, 4, -1]
  62.   [0, 1, 2, 4, 5, -1]
  63.   
  64. + substitute
  65. + a∩╝æa∩╝Æa∩╝ôa
  66. *** ../vim-7.4.322/src/version.c    2014-06-12 18:03:24.940319000 +0200
  67. --- src/version.c    2014-06-12 18:32:08.356384200 +0200
  68. ***************
  69. *** 736,737 ****
  70. --- 736,739 ----
  71.   {   /* Add new patch number below this line */
  72. + /**/
  73. +     323,
  74.   /**/
  75.  
  76. -- 
  77.        When danger reared its ugly head,
  78.        He bravely turned his tail and fled
  79.        Yes, Brave Sir Robin turned about
  80.        And gallantly he chickened out
  81.        Bravely taking to his feet
  82.        He beat a very brave retreat
  83.        Bravest of the brave Sir Robin
  84.        Petrified of being dead
  85.        Soiled his pants then brave Sir Robin
  86.        Turned away and fled.
  87.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  88.  
  89.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  90. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  91. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  92.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  93.