summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-06-16 21:20:48 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-16 21:20:48 +0100
commit5ea38d1e7fd597ffde13b292d43e12747f20e97f (patch)
tree999b0c14e9c516d94b6419693e07e2c4695a2757 /src/evalfunc.c
parentc72e31dfcc013ae840cd7f8899f2430b7f6812c9 (diff)
patch 8.2.5114: time limit on searchpair() does not work properlyv8.2.5114
Problem: Time limit on searchpair() does not work properly. Solution: Set the time limit once instead of for each regexp. (closes #10562)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 6335a6469c..b7d7643ae3 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -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)