summaryrefslogtreecommitdiffstats
path: root/patches/source/vim/patches/7.4.323
blob: 3faac9c69f1c3e40d6d856071ff721cbf177e7f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
To: vim_dev@googlegroups.com
Subject: Patch 7.4.323
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.323
Problem:    Substitute() with zero width pattern breaks multi-byte character.
Solution:   Take multi-byte character size into account. (Yukihiro Nakadaira)
Files:	    src/eval.c src/testdir/test69.in, src/testdir/test69.ok


*** ../vim-7.4.322/src/eval.c	2014-05-28 20:31:37.496292805 +0200
--- src/eval.c	2014-06-12 18:34:22.928389291 +0200
***************
*** 24848,24855 ****
  		if (zero_width == regmatch.startp[0])
  		{
  		    /* avoid getting stuck on a match with an empty string */
! 		    *((char_u *)ga.ga_data + ga.ga_len) = *tail++;
! 		    ++ga.ga_len;
  		    continue;
  		}
  		zero_width = regmatch.startp[0];
--- 24848,24858 ----
  		if (zero_width == regmatch.startp[0])
  		{
  		    /* avoid getting stuck on a match with an empty string */
! 		    i = MB_PTR2LEN(tail);
! 		    mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail,
! 								   (size_t)i);
! 		    ga.ga_len += i;
! 		    tail += i;
  		    continue;
  		}
  		zero_width = regmatch.startp[0];
*** ../vim-7.4.322/src/testdir/test69.in	2014-02-22 23:49:30.268896843 +0100
--- src/testdir/test69.in	2014-06-12 18:32:43.108385514 +0200
***************
*** 180,185 ****
--- 180,192 ----
  byteidxcomp
  
  STARTTEST
+ /^substitute
+ :let y = substitute('123', '\zs', 'a', 'g')    | put =y
+ ENDTEST
+ 
+ substitute
+ 
+ STARTTEST
  :g/^STARTTEST/.,/^ENDTEST/d
  :1;/^Results/,$wq! test.out
  ENDTEST
*** ../vim-7.4.322/src/testdir/test69.ok	2014-02-22 23:49:30.268896843 +0100
--- src/testdir/test69.ok	2014-06-12 18:32:43.108385514 +0200
***************
*** 160,162 ****
--- 160,166 ----
  [0, 1, 3, 4, -1]
  [0, 1, 2, 4, 5, -1]
  
+ 
+ substitute
+ a1a2a3a
+ 
*** ../vim-7.4.322/src/version.c	2014-06-12 18:03:24.940319000 +0200
--- src/version.c	2014-06-12 18:32:08.356384200 +0200
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     323,
  /**/

-- 
       When danger reared its ugly head,
       He bravely turned his tail and fled
       Yes, Brave Sir Robin turned about
       And gallantly he chickened out
       Bravely taking to his feet
       He beat a very brave retreat
       Bravest of the brave Sir Robin
       Petrified of being dead
       Soiled his pants then brave Sir Robin
       Turned away and fled.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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    ///