forked from aniani/vim
patch 9.0.0282: a nested timout stops the previous timeout
Problem: A nested timout stops the previous timeout. Solution: Ignore any nested timeout.
This commit is contained in:
@@ -9176,7 +9176,8 @@ do_searchpair(
|
|||||||
|
|
||||||
theend:
|
theend:
|
||||||
#ifdef FEAT_RELTIME
|
#ifdef FEAT_RELTIME
|
||||||
disable_regexp_timeout();
|
if (time_limit > 0)
|
||||||
|
disable_regexp_timeout();
|
||||||
#endif
|
#endif
|
||||||
vim_free(pat2);
|
vim_free(pat2);
|
||||||
vim_free(pat3);
|
vim_free(pat3);
|
||||||
|
|||||||
21
src/regexp.c
21
src/regexp.c
@@ -51,17 +51,32 @@ toggle_Magic(int x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_RELTIME
|
#ifdef FEAT_RELTIME
|
||||||
|
static int timeout_nesting = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Start a timer that will cause the regexp to abort after "msec".
|
||||||
|
* This doesn't work well recursively. In case it happens anyway, the first
|
||||||
|
* set timeout will prevail, nested ones are ignored.
|
||||||
|
* The caller must make sure there is a matching disable_regexp_timeout() call!
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
init_regexp_timeout(long msec)
|
init_regexp_timeout(long msec)
|
||||||
{
|
{
|
||||||
timeout_flag = start_timeout(msec);
|
if (timeout_nesting == 0)
|
||||||
|
timeout_flag = start_timeout(msec);
|
||||||
|
++timeout_nesting;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
disable_regexp_timeout(void)
|
disable_regexp_timeout(void)
|
||||||
{
|
{
|
||||||
stop_timeout();
|
if (timeout_nesting == 0)
|
||||||
timeout_flag = &dummy_timeout_flag;
|
iemsg("disable_regexp_timeout() called without active timer");
|
||||||
|
else if (--timeout_nesting == 0)
|
||||||
|
{
|
||||||
|
stop_timeout();
|
||||||
|
timeout_flag = &dummy_timeout_flag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -707,6 +707,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
282,
|
||||||
/**/
|
/**/
|
||||||
281,
|
281,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user