Bram Moolenaar <[email protected]> wrote:

> Patch 7.3.1116
> Problem:    Can't build without Visual mode.
> Solution:   Add #ifdefs.
> Files:      src/regexp_nfa.c
>
>
> *** ../vim-7.3.1115/src/regexp_nfa.c    2013-06-04 21:42:19.000000000 +0200
> --- src/regexp_nfa.c    2013-06-05 11:01:40.000000000 +0200
> ***************
> *** 181,187 ****
> --- 181,189 ----
>       NFA_MARK,         /*      Match mark */
>       NFA_MARK_GT,      /*      Match > mark */
>       NFA_MARK_LT,      /*      Match < mark */
> + #ifdef FEAT_VISUAL
>       NFA_VISUAL,               /*      Match Visual area */
> + #endif
>
>       NFA_FIRST_NL = NFA_ANY + ADD_NL,
>       NFA_LAST_NL = NFA_NUPPER + ADD_NL,
> ***************
> *** 963,971 ****
> --- 965,975 ----
>                     EMIT(NFA_CURSOR);
>                     break;
>
> + #ifdef FEAT_VISUAL
>                 case 'V':
>                     EMIT(NFA_VISUAL);
>                     break;
> + #endif
>
>                 case '[':
>                     /* TODO: \%[abc] not supported yet */
> ***************
> *** 1955,1961 ****
> --- 1959,1967 ----
>         case NFA_MARK_GT:       STRCPY(code, "NFA_MARK_GT "); break;
>         case NFA_MARK_LT:       STRCPY(code, "NFA_MARK_LT "); break;
>         case NFA_CURSOR:        STRCPY(code, "NFA_CURSOR "); break;
> + #ifdef FEAT_VISUAL
>         case NFA_VISUAL:        STRCPY(code, "NFA_VISUAL "); break;
> + #endif
>
>         case NFA_STAR:          STRCPY(code, "NFA_STAR "); break;
>         case NFA_STAR_NONGREEDY: STRCPY(code, "NFA_STAR_NONGREEDY "); break;
> ***************
> *** 4790,4801 ****
> --- 4796,4809 ----
>                                                             t->pim, &listidx);
>                 break;
>
> + #ifdef FEAT_VISUAL
>             case NFA_VISUAL:
>                 result = reg_match_visual();
>                 if (result)
>                     addstate_here(thislist, t->state->out, &t->subs,
>                                                             t->pim, &listidx);
>                 break;
> + #endif
>
>             default:    /* regular character */
>               {
> *** ../vim-7.3.1115/src/version.c       2013-06-04 22:13:45.000000000 +0200
> --- src/version.c       2013-06-04 23:42:50.000000000 +0200
> ***************
> *** 730,731 ****
> --- 730,733 ----
>   {   /* Add new patch number below this line */
> + /**/
> +     1116,
>   /**/


Hi

This patch introduces what looks like a bug in
vim tiny (built without FEAT_VISUAL).

With regexpengine=1 (old engine), doing...

:s/\%V./x

results in:

E486: Pattern not found: \%V.

With regexpengine=0 (new engine), doing the same....

:s/\%V./x

results in:

E867: (NFA) Unknown operator '\%V'
E476: Invalid command


Another difference with vim.tiny old engine:

:v/\%V./d

works without error and remove every lines.

With the new engine, doing the same does not
delete any line and give errors:

E867: (NFA) Unknown operator '\%V'
E476: Invalid command


I don't think it should be different between
the 2 regexp engines.  When VISUAL feature
is disabled, there is no way to visual select,
so using \%V will never match and the old
engine behavior is correct in my opinion.
Giving E867 & E476 is not right. At least there
is a discrepancies between regexp engines.

I think that the only difference in code, when
FEAT_VISUAL is disabled, is that it should
behave as if reg_match_visual() returned false.

The attached patch makes it work the same
as the old engine (as was in fact done in a
patch that I sent yesterday).

Regards
Dominique

-- 
-- 
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/groups/opt_out.


Attachment: fixed-visual-regexp_nfa.c-7.3.1122.patch
Description: Binary data

Raspunde prin e-mail lui