Mercurial > vim
diff src/evalfunc.c @ 29189:d1e263ecf634 v8.2.5114
patch 8.2.5114: time limit on searchpair() does not work properly
Commit: https://github.com/vim/vim/commit/5ea38d1e7fd597ffde13b292d43e12747f20e97f
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 16 21:20:48 2022 +0100
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 https://github.com/vim/vim/issues/10562)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 16 Jun 2022 22:30:03 +0200 |
parents | 755ab148288b |
children | f27ec19f2034 |
line wrap: on
line diff
--- 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)