1
0
forked from aniani/vim

patch 8.2.5114: time limit on searchpair() does not work properly

Problem:    Time limit on searchpair() does not work properly.
Solution:   Set the time limit once instead of for each regexp. (closes #10562)
This commit is contained in:
Bram Moolenaar
2022-06-16 21:20:48 +01:00
parent c72e31dfcc
commit 5ea38d1e7f
4 changed files with 42 additions and 11 deletions

View File

@@ -8975,6 +8975,10 @@ do_searchpair(
if (skip != NULL)
use_skip = eval_expr_valid_arg(skip);
#ifdef FEAT_RELTIME
if (time_limit > 0)
init_regexp_timeout(time_limit);
#endif
save_cursor = curwin->w_cursor;
pos = curwin->w_cursor;
CLEAR_POS(&firstpos);
@@ -8986,9 +8990,6 @@ do_searchpair(
CLEAR_FIELD(sia);
sia.sa_stop_lnum = lnum_stop;
#ifdef FEAT_RELTIME
sia.sa_tm = time_limit;
#endif
n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
options, RE_SEARCH, &sia);
if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos)))
@@ -9074,6 +9075,9 @@ do_searchpair(
curwin->w_cursor = save_cursor;
theend:
#ifdef FEAT_RELTIME
disable_regexp_timeout();
#endif
vim_free(pat2);
vim_free(pat3);
if (p_cpo == empty_option)