comparison src/eval.c @ 5964:238f5027830c v7.4.323

updated for version 7.4.323 Problem: Substitute() with zero width pattern breaks multi-byte character. Solution: Take multi-byte character size into account. (Yukihiro Nakadaira)
author Bram Moolenaar <bram@vim.org>
date Thu, 12 Jun 2014 18:39:22 +0200
parents 332a5c2b2956
children 99d8f2d72dcd
comparison
equal deleted inserted replaced
5963:c23596b8e34f 5964:238f5027830c
24846 if (regmatch.startp[0] == regmatch.endp[0]) 24846 if (regmatch.startp[0] == regmatch.endp[0])
24847 { 24847 {
24848 if (zero_width == regmatch.startp[0]) 24848 if (zero_width == regmatch.startp[0])
24849 { 24849 {
24850 /* avoid getting stuck on a match with an empty string */ 24850 /* avoid getting stuck on a match with an empty string */
24851 *((char_u *)ga.ga_data + ga.ga_len) = *tail++; 24851 i = MB_PTR2LEN(tail);
24852 ++ga.ga_len; 24852 mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail,
24853 (size_t)i);
24854 ga.ga_len += i;
24855 tail += i;
24853 continue; 24856 continue;
24854 } 24857 }
24855 zero_width = regmatch.startp[0]; 24858 zero_width = regmatch.startp[0];
24856 } 24859 }
24857 24860