On Mi, 18 Sep 2013, Christ van Willegen wrote:
> I accidentally searched the following
>
> /\(
>
> This gives me the error message
>
> E54: Unmatched \(
> E54: Unmatched \(
>
> twice.
This happens, because your 're' setting is 0. That means, if the
backtracking engine fails to compile the regular expression, vim will
automatically retry with the old engine. Therefore you get the error for
each tried regexp engine.
I think, this patch prevents this:
diff --git a/src/regexp.c b/src/regexp.c
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -8022,6 +8022,8 @@
*/
if (regexp_engine == AUTOMATIC_ENGINE)
prog = bt_regengine.regcomp(expr, re_flags);
+ if (emsg_off)
+ emsg_off--;
}
return prog;
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -6644,6 +6644,8 @@
/* TODO: only give this error for debugging? */
if (post_ptr >= post_end)
EMSGN("Internal error: estimated max number of states insufficient:
%ld", post_end - post_star
+ if (p_re == 0)
+ emsg_off++; /* prevent double errors */
goto fail; /* Cascaded (syntax?) error */
}
>
> When I search for
>
> /()
>
> I get
>
> E486: Pattern not found: ()
>
> (once)
>
> I have my command history set to 2 (:set ch=2), so I see them both at once.
>
> I'm running vim 7.4.27
>
> Christ van Willegen
Mit freundlichen Grüßen
Christian
--
Gott ist eine vom Menschen erdachte Hypothese bei dem Versuch, mit dem
Problem der Existenz fertigzuwerden.
-- Aldous Huxley
--
--
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.