mirror of
https://github.com/zoriya/vim.git
synced 2025-12-23 15:45:15 +00:00
patch 8.1.2173: searchit() has too many arguments
Problem: Searchit() has too many arguments. Solution: Move optional arguments to a struct. Add the "wrapped" argument.
This commit is contained in:
@@ -5694,12 +5694,13 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
|
|||||||
int dir;
|
int dir;
|
||||||
int retval = 0; /* default: FAIL */
|
int retval = 0; /* default: FAIL */
|
||||||
long lnum_stop = 0;
|
long lnum_stop = 0;
|
||||||
proftime_T tm;
|
|
||||||
#ifdef FEAT_RELTIME
|
#ifdef FEAT_RELTIME
|
||||||
|
proftime_T tm;
|
||||||
long time_limit = 0;
|
long time_limit = 0;
|
||||||
#endif
|
#endif
|
||||||
int options = SEARCH_KEEP;
|
int options = SEARCH_KEEP;
|
||||||
int subpatnum;
|
int subpatnum;
|
||||||
|
searchit_arg_T sia;
|
||||||
|
|
||||||
pat = tv_get_string(&argvars[0]);
|
pat = tv_get_string(&argvars[0]);
|
||||||
dir = get_search_arg(&argvars[1], flagsp); /* may set p_ws */
|
dir = get_search_arg(&argvars[1], flagsp); /* may set p_ws */
|
||||||
@@ -5748,8 +5749,13 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos = save_cursor = curwin->w_cursor;
|
pos = save_cursor = curwin->w_cursor;
|
||||||
|
vim_memset(&sia, 0, sizeof(sia));
|
||||||
|
sia.sa_stop_lnum = (linenr_T)lnum_stop;
|
||||||
|
#ifdef FEAT_RELTIME
|
||||||
|
sia.sa_tm = &tm;
|
||||||
|
#endif
|
||||||
subpatnum = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
|
subpatnum = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
|
||||||
options, RE_SEARCH, (linenr_T)lnum_stop, &tm, NULL);
|
options, RE_SEARCH, &sia);
|
||||||
if (subpatnum != FAIL)
|
if (subpatnum != FAIL)
|
||||||
{
|
{
|
||||||
if (flags & SP_SUBPAT)
|
if (flags & SP_SUBPAT)
|
||||||
@@ -6147,7 +6153,9 @@ do_searchpair(
|
|||||||
int use_skip = FALSE;
|
int use_skip = FALSE;
|
||||||
int err;
|
int err;
|
||||||
int options = SEARCH_KEEP;
|
int options = SEARCH_KEEP;
|
||||||
|
#ifdef FEAT_RELTIME
|
||||||
proftime_T tm;
|
proftime_T tm;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
|
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
|
||||||
save_cpo = p_cpo;
|
save_cpo = p_cpo;
|
||||||
@@ -6188,8 +6196,15 @@ do_searchpair(
|
|||||||
pat = pat3;
|
pat = pat3;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
searchit_arg_T sia;
|
||||||
|
|
||||||
|
vim_memset(&sia, 0, sizeof(sia));
|
||||||
|
sia.sa_stop_lnum = lnum_stop;
|
||||||
|
#ifdef FEAT_RELTIME
|
||||||
|
sia.sa_tm = &tm;
|
||||||
|
#endif
|
||||||
n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
|
n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
|
||||||
options, RE_SEARCH, lnum_stop, &tm, NULL);
|
options, RE_SEARCH, &sia);
|
||||||
if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos)))
|
if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos)))
|
||||||
/* didn't find it or found the first match again: FAIL */
|
/* didn't find it or found the first match again: FAIL */
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -3600,7 +3600,7 @@ get_address(
|
|||||||
curwin->w_cursor.col = 0;
|
curwin->w_cursor.col = 0;
|
||||||
searchcmdlen = 0;
|
searchcmdlen = 0;
|
||||||
flags = silent ? 0 : SEARCH_HIS | SEARCH_MSG;
|
flags = silent ? 0 : SEARCH_HIS | SEARCH_MSG;
|
||||||
if (!do_search(NULL, c, cmd, 1L, flags, NULL, NULL))
|
if (!do_search(NULL, c, cmd, 1L, flags, NULL))
|
||||||
{
|
{
|
||||||
curwin->w_cursor = pos;
|
curwin->w_cursor = pos;
|
||||||
cmd = NULL;
|
cmd = NULL;
|
||||||
@@ -3654,8 +3654,7 @@ get_address(
|
|||||||
pos.coladd = 0;
|
pos.coladd = 0;
|
||||||
if (searchit(curwin, curbuf, &pos, NULL,
|
if (searchit(curwin, curbuf, &pos, NULL,
|
||||||
*cmd == '?' ? BACKWARD : FORWARD,
|
*cmd == '?' ? BACKWARD : FORWARD,
|
||||||
(char_u *)"", 1L, SEARCH_MSG,
|
(char_u *)"", 1L, SEARCH_MSG, i, NULL) != FAIL)
|
||||||
i, (linenr_T)0, NULL, NULL) != FAIL)
|
|
||||||
lnum = pos.lnum;
|
lnum = pos.lnum;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ may_do_incsearch_highlighting(
|
|||||||
pos_T end_pos;
|
pos_T end_pos;
|
||||||
#ifdef FEAT_RELTIME
|
#ifdef FEAT_RELTIME
|
||||||
proftime_T tm;
|
proftime_T tm;
|
||||||
|
searchit_arg_T sia;
|
||||||
#endif
|
#endif
|
||||||
int next_char;
|
int next_char;
|
||||||
int use_last_pat;
|
int use_last_pat;
|
||||||
@@ -445,12 +446,16 @@ may_do_incsearch_highlighting(
|
|||||||
if (search_first_line != 0)
|
if (search_first_line != 0)
|
||||||
search_flags += SEARCH_START;
|
search_flags += SEARCH_START;
|
||||||
ccline.cmdbuff[skiplen + patlen] = NUL;
|
ccline.cmdbuff[skiplen + patlen] = NUL;
|
||||||
|
#ifdef FEAT_RELTIME
|
||||||
|
vim_memset(&sia, 0, sizeof(sia));
|
||||||
|
sia.sa_tm = &tm;
|
||||||
|
#endif
|
||||||
found = do_search(NULL, firstc == ':' ? '/' : firstc,
|
found = do_search(NULL, firstc == ':' ? '/' : firstc,
|
||||||
ccline.cmdbuff + skiplen, count, search_flags,
|
ccline.cmdbuff + skiplen, count, search_flags,
|
||||||
#ifdef FEAT_RELTIME
|
#ifdef FEAT_RELTIME
|
||||||
&tm, NULL
|
&sia
|
||||||
#else
|
#else
|
||||||
NULL, NULL
|
NULL
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
ccline.cmdbuff[skiplen + patlen] = next_char;
|
ccline.cmdbuff[skiplen + patlen] = next_char;
|
||||||
@@ -597,8 +602,7 @@ may_adjust_incsearch_highlighting(
|
|||||||
pat[patlen] = NUL;
|
pat[patlen] = NUL;
|
||||||
i = searchit(curwin, curbuf, &t, NULL,
|
i = searchit(curwin, curbuf, &t, NULL,
|
||||||
c == Ctrl_G ? FORWARD : BACKWARD,
|
c == Ctrl_G ? FORWARD : BACKWARD,
|
||||||
pat, count, search_flags,
|
pat, count, search_flags, RE_SEARCH, NULL);
|
||||||
RE_SEARCH, 0, NULL, NULL);
|
|
||||||
--emsg_off;
|
--emsg_off;
|
||||||
pat[patlen] = save;
|
pat[patlen] = save;
|
||||||
if (i)
|
if (i)
|
||||||
|
|||||||
@@ -5383,7 +5383,7 @@ gui_do_findrepl(
|
|||||||
i = msg_scroll;
|
i = msg_scroll;
|
||||||
if (down)
|
if (down)
|
||||||
{
|
{
|
||||||
(void)do_search(NULL, '/', ga.ga_data, 1L, searchflags, NULL, NULL);
|
(void)do_search(NULL, '/', ga.ga_data, 1L, searchflags, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -5391,7 +5391,7 @@ gui_do_findrepl(
|
|||||||
* direction */
|
* direction */
|
||||||
p = vim_strsave_escaped(ga.ga_data, (char_u *)"?");
|
p = vim_strsave_escaped(ga.ga_data, (char_u *)"?");
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
(void)do_search(NULL, '?', p, 1L, searchflags, NULL, NULL);
|
(void)do_search(NULL, '?', p, 1L, searchflags, NULL);
|
||||||
vim_free(p);
|
vim_free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2881,7 +2881,7 @@ ins_compl_get_exp(pos_T *ini)
|
|||||||
found_new_match = searchit(NULL, ins_buf, pos, NULL,
|
found_new_match = searchit(NULL, ins_buf, pos, NULL,
|
||||||
compl_direction,
|
compl_direction,
|
||||||
compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG,
|
compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG,
|
||||||
RE_LAST, (linenr_T)0, NULL, NULL);
|
RE_LAST, NULL);
|
||||||
--msg_silent;
|
--msg_silent;
|
||||||
if (!compl_started || set_match_pos)
|
if (!compl_started || set_match_pos)
|
||||||
{
|
{
|
||||||
|
|||||||
26
src/normal.c
26
src/normal.c
@@ -65,7 +65,7 @@ static void nv_end(cmdarg_T *cap);
|
|||||||
static void nv_dollar(cmdarg_T *cap);
|
static void nv_dollar(cmdarg_T *cap);
|
||||||
static void nv_search(cmdarg_T *cap);
|
static void nv_search(cmdarg_T *cap);
|
||||||
static void nv_next(cmdarg_T *cap);
|
static void nv_next(cmdarg_T *cap);
|
||||||
static int normal_search(cmdarg_T *cap, int dir, char_u *pat, int opt);
|
static int normal_search(cmdarg_T *cap, int dir, char_u *pat, int opt, int *wrapped);
|
||||||
static void nv_csearch(cmdarg_T *cap);
|
static void nv_csearch(cmdarg_T *cap);
|
||||||
static void nv_brackets(cmdarg_T *cap);
|
static void nv_brackets(cmdarg_T *cap);
|
||||||
static void nv_percent(cmdarg_T *cap);
|
static void nv_percent(cmdarg_T *cap);
|
||||||
@@ -2346,7 +2346,7 @@ find_decl(
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
t = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD,
|
t = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD,
|
||||||
pat, 1L, searchflags, RE_LAST, (linenr_T)0, NULL, NULL);
|
pat, 1L, searchflags, RE_LAST, NULL);
|
||||||
if (curwin->w_cursor.lnum >= old_pos.lnum)
|
if (curwin->w_cursor.lnum >= old_pos.lnum)
|
||||||
t = FAIL; /* match after start is failure too */
|
t = FAIL; /* match after start is failure too */
|
||||||
|
|
||||||
@@ -3730,7 +3730,7 @@ nv_ident(cmdarg_T *cap)
|
|||||||
init_history();
|
init_history();
|
||||||
add_to_history(HIST_SEARCH, buf, TRUE, NUL);
|
add_to_history(HIST_SEARCH, buf, TRUE, NUL);
|
||||||
|
|
||||||
(void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0);
|
(void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4257,7 +4257,7 @@ nv_search(cmdarg_T *cap)
|
|||||||
|
|
||||||
(void)normal_search(cap, cap->cmdchar, cap->searchbuf,
|
(void)normal_search(cap, cap->cmdchar, cap->searchbuf,
|
||||||
(cap->arg || !EQUAL_POS(save_cursor, curwin->w_cursor))
|
(cap->arg || !EQUAL_POS(save_cursor, curwin->w_cursor))
|
||||||
? 0 : SEARCH_MARK);
|
? 0 : SEARCH_MARK, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -4267,16 +4267,17 @@ nv_search(cmdarg_T *cap)
|
|||||||
static void
|
static void
|
||||||
nv_next(cmdarg_T *cap)
|
nv_next(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
pos_T old = curwin->w_cursor;
|
pos_T old = curwin->w_cursor;
|
||||||
int i = normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg);
|
int wrapped = FALSE;
|
||||||
|
int i = normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg, &wrapped);
|
||||||
|
|
||||||
if (i == 1 && EQUAL_POS(old, curwin->w_cursor))
|
if (i == 1 && !wrapped && EQUAL_POS(old, curwin->w_cursor))
|
||||||
{
|
{
|
||||||
/* Avoid getting stuck on the current cursor position, which can
|
/* Avoid getting stuck on the current cursor position, which can
|
||||||
* happen when an offset is given and the cursor is on the last char
|
* happen when an offset is given and the cursor is on the last char
|
||||||
* in the buffer: Repeat with count + 1. */
|
* in the buffer: Repeat with count + 1. */
|
||||||
cap->count1 += 1;
|
cap->count1 += 1;
|
||||||
(void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg);
|
(void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg, NULL);
|
||||||
cap->count1 -= 1;
|
cap->count1 -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4291,17 +4292,22 @@ normal_search(
|
|||||||
cmdarg_T *cap,
|
cmdarg_T *cap,
|
||||||
int dir,
|
int dir,
|
||||||
char_u *pat,
|
char_u *pat,
|
||||||
int opt) /* extra flags for do_search() */
|
int opt, // extra flags for do_search()
|
||||||
|
int *wrapped)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
searchit_arg_T sia;
|
||||||
|
|
||||||
cap->oap->motion_type = MCHAR;
|
cap->oap->motion_type = MCHAR;
|
||||||
cap->oap->inclusive = FALSE;
|
cap->oap->inclusive = FALSE;
|
||||||
cap->oap->use_reg_one = TRUE;
|
cap->oap->use_reg_one = TRUE;
|
||||||
curwin->w_set_curswant = TRUE;
|
curwin->w_set_curswant = TRUE;
|
||||||
|
|
||||||
|
vim_memset(&sia, 0, sizeof(sia));
|
||||||
i = do_search(cap->oap, dir, pat, cap->count1,
|
i = do_search(cap->oap, dir, pat, cap->count1,
|
||||||
opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, NULL, NULL);
|
opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, &sia);
|
||||||
|
if (wrapped != NULL)
|
||||||
|
*wrapped = sia.sa_wrapped;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
clearop(cap->oap);
|
clearop(cap->oap);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ char_u *last_search_pat(void);
|
|||||||
void reset_search_dir(void);
|
void reset_search_dir(void);
|
||||||
void set_last_search_pat(char_u *s, int idx, int magic, int setlast);
|
void set_last_search_pat(char_u *s, int idx, int magic, int setlast);
|
||||||
void last_pat_prog(regmmatch_T *regmatch);
|
void last_pat_prog(regmmatch_T *regmatch);
|
||||||
int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, int dir, char_u *pat, long count, int options, int pat_use, linenr_T stop_lnum, proftime_T *tm, int *timed_out);
|
int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, int dir, char_u *pat, long count, int options, int pat_use, searchit_arg_T *extra_arg);
|
||||||
void set_search_direction(int cdir);
|
void set_search_direction(int cdir);
|
||||||
int do_search(oparg_T *oap, int dirc, char_u *pat, long count, int options, proftime_T *tm, int *timed_out);
|
int do_search(oparg_T *oap, int dirc, char_u *pat, long count, int options, searchit_arg_T *sia);
|
||||||
int search_for_exact_line(buf_T *buf, pos_T *pos, int dir, char_u *pat);
|
int search_for_exact_line(buf_T *buf, pos_T *pos, int dir, char_u *pat);
|
||||||
int searchc(cmdarg_T *cap, int t_cmd);
|
int searchc(cmdarg_T *cap, int t_cmd);
|
||||||
pos_T *findmatch(oparg_T *oap, int initc);
|
pos_T *findmatch(oparg_T *oap, int initc);
|
||||||
@@ -46,6 +46,6 @@ int current_quote(oparg_T *oap, long count, int include, int quotechar);
|
|||||||
int current_search(long count, int forward);
|
int current_search(long count, int forward);
|
||||||
int linewhite(linenr_T lnum);
|
int linewhite(linenr_T lnum);
|
||||||
void find_pattern_in_path(char_u *ptr, int dir, int len, int whole, int skip_comments, int type, long count, int action, linenr_T start_lnum, linenr_T end_lnum);
|
void find_pattern_in_path(char_u *ptr, int dir, int len, int whole, int skip_comments, int type, long count, int action, linenr_T start_lnum, linenr_T end_lnum);
|
||||||
struct spat *get_spat(int idx);
|
spat_T *get_spat(int idx);
|
||||||
int get_spat_last_idx(void);
|
int get_spat_last_idx(void);
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
|||||||
@@ -3207,8 +3207,7 @@ qf_jump_goto_line(
|
|||||||
// Move the cursor to the first line in the buffer
|
// Move the cursor to the first line in the buffer
|
||||||
save_cursor = curwin->w_cursor;
|
save_cursor = curwin->w_cursor;
|
||||||
curwin->w_cursor.lnum = 0;
|
curwin->w_cursor.lnum = 0;
|
||||||
if (!do_search(NULL, '/', qf_pattern, (long)1,
|
if (!do_search(NULL, '/', qf_pattern, (long)1, SEARCH_KEEP, NULL))
|
||||||
SEARCH_KEEP, NULL, NULL))
|
|
||||||
curwin->w_cursor = save_cursor;
|
curwin->w_cursor = save_cursor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
40
src/search.c
40
src/search.c
@@ -595,8 +595,8 @@ last_pat_prog(regmmatch_T *regmatch)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
searchit(
|
searchit(
|
||||||
win_T *win, /* window to search in; can be NULL for a
|
win_T *win, // window to search in; can be NULL for a
|
||||||
buffer without a window! */
|
// buffer without a window!
|
||||||
buf_T *buf,
|
buf_T *buf,
|
||||||
pos_T *pos,
|
pos_T *pos,
|
||||||
pos_T *end_pos, // set to end of the match, unless NULL
|
pos_T *end_pos, // set to end of the match, unless NULL
|
||||||
@@ -604,10 +604,8 @@ searchit(
|
|||||||
char_u *pat,
|
char_u *pat,
|
||||||
long count,
|
long count,
|
||||||
int options,
|
int options,
|
||||||
int pat_use, /* which pattern to use when "pat" is empty */
|
int pat_use, // which pattern to use when "pat" is empty
|
||||||
linenr_T stop_lnum, /* stop after this line number when != 0 */
|
searchit_arg_T *extra_arg) // optional extra arguments, can be NULL
|
||||||
proftime_T *tm UNUSED, /* timeout limit or NULL */
|
|
||||||
int *timed_out UNUSED) /* set when timed out or NULL */
|
|
||||||
{
|
{
|
||||||
int found;
|
int found;
|
||||||
linenr_T lnum; /* no init to shut up Apollo cc */
|
linenr_T lnum; /* no init to shut up Apollo cc */
|
||||||
@@ -630,6 +628,20 @@ searchit(
|
|||||||
#ifdef FEAT_SEARCH_EXTRA
|
#ifdef FEAT_SEARCH_EXTRA
|
||||||
int break_loop = FALSE;
|
int break_loop = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
linenr_T stop_lnum = 0; // stop after this line number when != 0
|
||||||
|
#ifdef FEAT_RELTIME
|
||||||
|
proftime_T *tm = NULL; // timeout limit or NULL
|
||||||
|
int *timed_out = NULL; // set when timed out or NULL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (extra_arg != NULL)
|
||||||
|
{
|
||||||
|
stop_lnum = extra_arg->sa_stop_lnum;
|
||||||
|
#ifdef FEAT_RELTIME
|
||||||
|
tm = extra_arg->sa_tm;
|
||||||
|
timed_out = &extra_arg->sa_timed_out;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (search_regcomp(pat, RE_SEARCH, pat_use,
|
if (search_regcomp(pat, RE_SEARCH, pat_use,
|
||||||
(options & (SEARCH_HIS + SEARCH_KEEP)), ®match) == FAIL)
|
(options & (SEARCH_HIS + SEARCH_KEEP)), ®match) == FAIL)
|
||||||
@@ -1067,6 +1079,8 @@ searchit(
|
|||||||
if (!shortmess(SHM_SEARCH) && (options & SEARCH_MSG))
|
if (!shortmess(SHM_SEARCH) && (options & SEARCH_MSG))
|
||||||
give_warning((char_u *)_(dir == BACKWARD
|
give_warning((char_u *)_(dir == BACKWARD
|
||||||
? top_bot_msg : bot_top_msg), TRUE);
|
? top_bot_msg : bot_top_msg), TRUE);
|
||||||
|
if (extra_arg != NULL)
|
||||||
|
extra_arg->sa_wrapped = TRUE;
|
||||||
}
|
}
|
||||||
if (got_int || called_emsg
|
if (got_int || called_emsg
|
||||||
#ifdef FEAT_RELTIME
|
#ifdef FEAT_RELTIME
|
||||||
@@ -1178,8 +1192,7 @@ do_search(
|
|||||||
char_u *pat,
|
char_u *pat,
|
||||||
long count,
|
long count,
|
||||||
int options,
|
int options,
|
||||||
proftime_T *tm, /* timeout limit or NULL */
|
searchit_arg_T *sia) // optional arguments or NULL
|
||||||
int *timed_out) /* flag set on timeout or NULL */
|
|
||||||
{
|
{
|
||||||
pos_T pos; /* position of the last match */
|
pos_T pos; /* position of the last match */
|
||||||
char_u *searchstr;
|
char_u *searchstr;
|
||||||
@@ -1269,7 +1282,7 @@ do_search(
|
|||||||
*/
|
*/
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
int show_top_bot_msg = FALSE;
|
int show_top_bot_msg = FALSE;
|
||||||
|
|
||||||
searchstr = pat;
|
searchstr = pat;
|
||||||
dircp = NULL;
|
dircp = NULL;
|
||||||
@@ -1511,7 +1524,7 @@ do_search(
|
|||||||
(SEARCH_KEEP + SEARCH_PEEK + SEARCH_HIS
|
(SEARCH_KEEP + SEARCH_PEEK + SEARCH_HIS
|
||||||
+ SEARCH_MSG + SEARCH_START
|
+ SEARCH_MSG + SEARCH_START
|
||||||
+ ((pat != NULL && *pat == ';') ? 0 : SEARCH_NOOF))),
|
+ ((pat != NULL && *pat == ';') ? 0 : SEARCH_NOOF))),
|
||||||
RE_LAST, (linenr_T)0, tm, timed_out);
|
RE_LAST, sia);
|
||||||
|
|
||||||
if (dircp != NULL)
|
if (dircp != NULL)
|
||||||
*dircp = dirc; // restore second '/' or '?' for normal_cmd()
|
*dircp = dirc; // restore second '/' or '?' for normal_cmd()
|
||||||
@@ -4741,7 +4754,7 @@ current_search(
|
|||||||
result = searchit(curwin, curbuf, &pos, &end_pos,
|
result = searchit(curwin, curbuf, &pos, &end_pos,
|
||||||
(dir ? FORWARD : BACKWARD),
|
(dir ? FORWARD : BACKWARD),
|
||||||
spats[last_idx].pat, (long) (i ? count : 1),
|
spats[last_idx].pat, (long) (i ? count : 1),
|
||||||
SEARCH_KEEP | flags, RE_SEARCH, 0, NULL, NULL);
|
SEARCH_KEEP | flags, RE_SEARCH, NULL);
|
||||||
|
|
||||||
/* First search may fail, but then start searching from the
|
/* First search may fail, but then start searching from the
|
||||||
* beginning of the file (cursor might be on the search match)
|
* beginning of the file (cursor might be on the search match)
|
||||||
@@ -4854,7 +4867,7 @@ is_one_char(char_u *pattern, int move, pos_T *cur, int direction)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (searchit(curwin, curbuf, &pos, NULL, direction, pattern, 1,
|
if (searchit(curwin, curbuf, &pos, NULL, direction, pattern, 1,
|
||||||
SEARCH_KEEP + flag, RE_SEARCH, 0, NULL, NULL) != FAIL)
|
SEARCH_KEEP + flag, RE_SEARCH, NULL) != FAIL)
|
||||||
{
|
{
|
||||||
/* Zero-width pattern should match somewhere, then we can check if
|
/* Zero-width pattern should match somewhere, then we can check if
|
||||||
* start and end are in the same position. */
|
* start and end are in the same position. */
|
||||||
@@ -4954,8 +4967,7 @@ search_stat(
|
|||||||
profile_setlimit(20L, &start);
|
profile_setlimit(20L, &start);
|
||||||
#endif
|
#endif
|
||||||
while (!got_int && searchit(curwin, curbuf, &lastpos, NULL,
|
while (!got_int && searchit(curwin, curbuf, &lastpos, NULL,
|
||||||
FORWARD, NULL, 1, SEARCH_KEEP, RE_LAST,
|
FORWARD, NULL, 1, SEARCH_KEEP, RE_LAST, NULL) != FAIL)
|
||||||
(linenr_T)0, NULL, NULL) != FAIL)
|
|
||||||
{
|
{
|
||||||
#ifdef FEAT_RELTIME
|
#ifdef FEAT_RELTIME
|
||||||
// Stop after passing the time limit.
|
// Stop after passing the time limit.
|
||||||
|
|||||||
@@ -2861,7 +2861,7 @@ ex_spellrepall(exarg_T *eap UNUSED)
|
|||||||
curwin->w_cursor.lnum = 0;
|
curwin->w_cursor.lnum = 0;
|
||||||
while (!got_int)
|
while (!got_int)
|
||||||
{
|
{
|
||||||
if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP, NULL, NULL) == 0
|
if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP, NULL) == 0
|
||||||
|| u_save_cursor() == FAIL)
|
|| u_save_cursor() == FAIL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -3871,6 +3871,19 @@ typedef struct spat
|
|||||||
soffset_T off;
|
soffset_T off;
|
||||||
} spat_T;
|
} spat_T;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Optional extra arguments for searchit().
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
linenr_T sa_stop_lnum; // stop after this line number when != 0
|
||||||
|
#ifdef FEAT_RELTIME
|
||||||
|
proftime_T *sa_tm; // timeout limit or NULL
|
||||||
|
int sa_timed_out; // set when timed out
|
||||||
|
#endif
|
||||||
|
int sa_wrapped; // search wrapped around
|
||||||
|
} searchit_arg_T;
|
||||||
|
|
||||||
#define WRITEBUFSIZE 8192 // size of normal write buffer
|
#define WRITEBUFSIZE 8192 // size of normal write buffer
|
||||||
|
|
||||||
#define FIO_LATIN1 0x01 // convert Latin1
|
#define FIO_LATIN1 0x01 // convert Latin1
|
||||||
|
|||||||
@@ -3542,7 +3542,7 @@ jumpto_tag(
|
|||||||
save_lnum = curwin->w_cursor.lnum;
|
save_lnum = curwin->w_cursor.lnum;
|
||||||
curwin->w_cursor.lnum = 0; /* start search before first line */
|
curwin->w_cursor.lnum = 0; /* start search before first line */
|
||||||
if (do_search(NULL, pbuf[0], pbuf + 1, (long)1,
|
if (do_search(NULL, pbuf[0], pbuf + 1, (long)1,
|
||||||
search_options, NULL, NULL))
|
search_options, NULL))
|
||||||
retval = OK;
|
retval = OK;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -3554,7 +3554,7 @@ jumpto_tag(
|
|||||||
*/
|
*/
|
||||||
p_ic = TRUE;
|
p_ic = TRUE;
|
||||||
if (!do_search(NULL, pbuf[0], pbuf + 1, (long)1,
|
if (!do_search(NULL, pbuf[0], pbuf + 1, (long)1,
|
||||||
search_options, NULL, NULL))
|
search_options, NULL))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Failed to find pattern, take a guess: "^func ("
|
* Failed to find pattern, take a guess: "^func ("
|
||||||
@@ -3565,13 +3565,13 @@ jumpto_tag(
|
|||||||
*tagp.tagname_end = NUL;
|
*tagp.tagname_end = NUL;
|
||||||
sprintf((char *)pbuf, "^%s\\s\\*(", tagp.tagname);
|
sprintf((char *)pbuf, "^%s\\s\\*(", tagp.tagname);
|
||||||
if (!do_search(NULL, '/', pbuf, (long)1,
|
if (!do_search(NULL, '/', pbuf, (long)1,
|
||||||
search_options, NULL, NULL))
|
search_options, NULL))
|
||||||
{
|
{
|
||||||
/* Guess again: "^char * \<func (" */
|
/* Guess again: "^char * \<func (" */
|
||||||
sprintf((char *)pbuf, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(",
|
sprintf((char *)pbuf, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(",
|
||||||
tagp.tagname);
|
tagp.tagname);
|
||||||
if (!do_search(NULL, '/', pbuf, (long)1,
|
if (!do_search(NULL, '/', pbuf, (long)1,
|
||||||
search_options, NULL, NULL))
|
search_options, NULL))
|
||||||
found = 0;
|
found = 0;
|
||||||
}
|
}
|
||||||
*tagp.tagname_end = cc;
|
*tagp.tagname_end = cc;
|
||||||
|
|||||||
@@ -741,6 +741,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 */
|
||||||
|
/**/
|
||||||
|
2173,
|
||||||
/**/
|
/**/
|
||||||
2172,
|
2172,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user