On Wed, Jun 4, 2014 at 9:21 PM, Christ van Willegen <[email protected]>
wrote:

> Hi,
>
> On Wed, Jun 4, 2014 at 1:47 PM, Yukihiro Nakadaira
> <[email protected]> wrote:
> > substitute() with zero width pattern breaks multi-byte character.
> >
> > Please check the following patch.
> >
> > diff -r bed71c37618c src/eval.c
> > --- a/src/eval.c    Thu May 29 14:36:29 2014 +0200
> > +++ b/src/eval.c    Wed Jun 04 20:44:48 2014 +0900
> > @@ -24848,8 +24848,11 @@
> >          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;
> > +            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;
> >          }
>
> Shouldn't you check for #ifdef FEAT_MBYTE somewhere in this patch?
>

I think MB_PTR2LEN macro is enough for it.

-- 
Yukihiro Nakadaira - [email protected]

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui