On Nov 24, 2007 2:04 PM, Bram Moolenaar <[EMAIL PROTECTED]> wrote:

> Thanks for locating this problem.  For the fix I think it's simplest to
> use utf_ptr2len().  It checks for the NUL character in the same way as
> mb_ptr2char():
>
> *** ../vim-7.1.159/src/regexp.c Sat Aug 11 13:57:31 2007
> --- src/regexp.c        Sat Nov 24 13:23:53 2007
> ***************
> *** 2770,2776 ****
>       {
>   #ifdef FEAT_MBYTE
>         if (enc_utf8)
> !           prevchr_len += utf_char2len(mb_ptr2char(regparse + prevchr_len));
>         else if (has_mbyte)
>             prevchr_len += (*mb_ptr2len)(regparse + prevchr_len);
>         else
> --- 2770,2777 ----
>       {
>   #ifdef FEAT_MBYTE
>         if (enc_utf8)
> !           /* exclude composing chars that mb_ptr2len does include */
> !           prevchr_len += utf_ptr2len(regparse + prevchr_len);
>         else if (has_mbyte)
>             prevchr_len += (*mb_ptr2len)(regparse + prevchr_len);
>         else
>
> Not sure if that fixes all situations, perhaps you can check that?


I confirm that your solution appears to fix the problem
I described.  I have checked several regex with invalid
or incomplete utf-8 sequences and no errors were detected
after applying your patch.

Thanks
-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui