Patch 8.1.2173
Problem: Searchit() has too many arguments.
Solution: Move optional arguments to a struct. Add the "wrapped" argument.
Files: src/search.c, src/proto/search.pro, src/structs.h, src/evalfunc.c,
src/ex_docmd.c, src/gui.c, src/quickfix.c, src/spell.c, src/tag.c,
src/ex_getln.c, src/insexpand.c, src/normal.c
*** ../vim-8.1.2172/src/search.c 2019-10-09 22:01:20.599438001 +0200
--- src/search.c 2019-10-18 20:46:58.165135556 +0200
***************
*** 595,602 ****
*/
int
searchit(
! win_T *win, /* window to search in; can be NULL for a
! buffer without a window! */
buf_T *buf,
pos_T *pos,
pos_T *end_pos, // set to end of the match, unless NULL
--- 595,602 ----
*/
int
searchit(
! win_T *win, // window to search in; can be NULL for a
! // buffer without a window!
buf_T *buf,
pos_T *pos,
pos_T *end_pos, // set to end of the match, unless NULL
***************
*** 604,613 ****
char_u *pat,
long count,
int options,
! int pat_use, /* which pattern to use when "pat" is
empty */
! linenr_T stop_lnum, /* stop after this line number when != 0 */
! proftime_T *tm UNUSED, /* timeout limit or NULL */
! int *timed_out UNUSED) /* set when timed out or NULL */
{
int found;
linenr_T lnum; /* no init to shut up Apollo cc */
--- 604,611 ----
char_u *pat,
long count,
int options,
! int pat_use, // which pattern to use when "pat" is
empty
! searchit_arg_T *extra_arg) // optional extra arguments, can be NULL
{
int found;
linenr_T lnum; /* no init to shut up Apollo cc */
***************
*** 630,635 ****
--- 628,647 ----
#ifdef FEAT_SEARCH_EXTRA
int break_loop = FALSE;
#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,
(options & (SEARCH_HIS + SEARCH_KEEP)), ®match) == FAIL)
***************
*** 1067,1072 ****
--- 1079,1086 ----
if (!shortmess(SHM_SEARCH) && (options & SEARCH_MSG))
give_warning((char_u *)_(dir == BACKWARD
? top_bot_msg : bot_top_msg), TRUE);
+ if (extra_arg != NULL)
+ extra_arg->sa_wrapped = TRUE;
}
if (got_int || called_emsg
#ifdef FEAT_RELTIME
***************
*** 1178,1185 ****
char_u *pat,
long count,
int options,
! proftime_T *tm, /* timeout limit or NULL */
! int *timed_out) /* flag set on timeout or NULL */
{
pos_T pos; /* position of the last match */
char_u *searchstr;
--- 1192,1198 ----
char_u *pat,
long count,
int options,
! searchit_arg_T *sia) // optional arguments or NULL
{
pos_T pos; /* position of the last match */
char_u *searchstr;
***************
*** 1269,1275 ****
*/
for (;;)
{
! int show_top_bot_msg = FALSE;
searchstr = pat;
dircp = NULL;
--- 1282,1288 ----
*/
for (;;)
{
! int show_top_bot_msg = FALSE;
searchstr = pat;
dircp = NULL;
***************
*** 1511,1517 ****
(SEARCH_KEEP + SEARCH_PEEK + SEARCH_HIS
+ SEARCH_MSG + SEARCH_START
+ ((pat != NULL && *pat == ';') ? 0 : SEARCH_NOOF))),
! RE_LAST, (linenr_T)0, tm, timed_out);
if (dircp != NULL)
*dircp = dirc; // restore second '/' or '?' for normal_cmd()
--- 1524,1530 ----
(SEARCH_KEEP + SEARCH_PEEK + SEARCH_HIS
+ SEARCH_MSG + SEARCH_START
+ ((pat != NULL && *pat == ';') ? 0 : SEARCH_NOOF))),
! RE_LAST, sia);
if (dircp != NULL)
*dircp = dirc; // restore second '/' or '?' for normal_cmd()
***************
*** 4741,4747 ****
result = searchit(curwin, curbuf, &pos, &end_pos,
(dir ? FORWARD : BACKWARD),
spats[last_idx].pat, (long) (i ? count : 1),
! SEARCH_KEEP | flags, RE_SEARCH, 0, NULL, NULL);
/* First search may fail, but then start searching from the
* beginning of the file (cursor might be on the search match)
--- 4754,4760 ----
result = searchit(curwin, curbuf, &pos, &end_pos,
(dir ? FORWARD : BACKWARD),
spats[last_idx].pat, (long) (i ? count : 1),
! SEARCH_KEEP | flags, RE_SEARCH, NULL);
/* First search may fail, but then start searching from the
* beginning of the file (cursor might be on the search match)
***************
*** 4854,4860 ****
}
if (searchit(curwin, curbuf, &pos, NULL, direction, pattern, 1,
! SEARCH_KEEP + flag, RE_SEARCH, 0, NULL, NULL) != FAIL)
{
/* Zero-width pattern should match somewhere, then we can check if
* start and end are in the same position. */
--- 4867,4873 ----
}
if (searchit(curwin, curbuf, &pos, NULL, direction, pattern, 1,
! SEARCH_KEEP + flag, RE_SEARCH, NULL) != FAIL)
{
/* Zero-width pattern should match somewhere, then we can check if
* start and end are in the same position. */
***************
*** 4954,4961 ****
profile_setlimit(20L, &start);
#endif
while (!got_int && searchit(curwin, curbuf, &lastpos, NULL,
! FORWARD, NULL, 1, SEARCH_KEEP, RE_LAST,
! (linenr_T)0, NULL, NULL) != FAIL)
{
#ifdef FEAT_RELTIME
// Stop after passing the time limit.
--- 4967,4973 ----
profile_setlimit(20L, &start);
#endif
while (!got_int && searchit(curwin, curbuf, &lastpos, NULL,
! FORWARD, NULL, 1, SEARCH_KEEP, RE_LAST, NULL) != FAIL)
{
#ifdef FEAT_RELTIME
// Stop after passing the time limit.
*** ../vim-8.1.2172/src/proto/search.pro 2019-07-23 22:15:21.307518880
+0200
--- src/proto/search.pro 2019-10-17 23:42:01.568921775 +0200
***************
*** 22,30 ****
void reset_search_dir(void);
void set_last_search_pat(char_u *s, int idx, int magic, int setlast);
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);
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 search_for_exact_line(buf_T *buf, pos_T *pos, int dir, char_u *pat);
int searchc(cmdarg_T *cap, int t_cmd);
pos_T *findmatch(oparg_T *oap, int initc);
--- 22,30 ----
void reset_search_dir(void);
void set_last_search_pat(char_u *s, int idx, int magic, int setlast);
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, searchit_arg_T *extra_arg);
void set_search_direction(int cdir);
! 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 searchc(cmdarg_T *cap, int t_cmd);
pos_T *findmatch(oparg_T *oap, int initc);
***************
*** 46,51 ****
int current_search(long count, int forward);
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);
! struct spat *get_spat(int idx);
int get_spat_last_idx(void);
/* vim: set ft=c : */
--- 46,51 ----
int current_search(long count, int forward);
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);
! spat_T *get_spat(int idx);
int get_spat_last_idx(void);
/* vim: set ft=c : */
*** ../vim-8.1.2172/src/structs.h 2019-10-13 16:43:35.960359646 +0200
--- src/structs.h 2019-10-17 23:14:49.439052795 +0200
***************
*** 3871,3876 ****
--- 3871,3889 ----
soffset_T off;
} 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 FIO_LATIN1 0x01 // convert Latin1
*** ../vim-8.1.2172/src/evalfunc.c 2019-10-17 22:58:59.062497024 +0200
--- src/evalfunc.c 2019-10-18 20:43:25.944958109 +0200
***************
*** 5694,5705 ****
int dir;
int retval = 0; /* default: FAIL */
long lnum_stop = 0;
- proftime_T tm;
#ifdef FEAT_RELTIME
long time_limit = 0;
#endif
int options = SEARCH_KEEP;
int subpatnum;
pat = tv_get_string(&argvars[0]);
dir = get_search_arg(&argvars[1], flagsp); /* may set p_ws */
--- 5694,5706 ----
int dir;
int retval = 0; /* default: FAIL */
long lnum_stop = 0;
#ifdef FEAT_RELTIME
+ proftime_T tm;
long time_limit = 0;
#endif
int options = SEARCH_KEEP;
int subpatnum;
+ searchit_arg_T sia;
pat = tv_get_string(&argvars[0]);
dir = get_search_arg(&argvars[1], flagsp); /* may set p_ws */
***************
*** 5748,5755 ****
}
pos = save_cursor = curwin->w_cursor;
subpatnum = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
! options, RE_SEARCH, (linenr_T)lnum_stop, &tm, NULL);
if (subpatnum != FAIL)
{
if (flags & SP_SUBPAT)
--- 5749,5761 ----
}
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,
! options, RE_SEARCH, &sia);
if (subpatnum != FAIL)
{
if (flags & SP_SUBPAT)
***************
*** 6147,6153 ****
--- 6153,6161 ----
int use_skip = FALSE;
int err;
int options = SEARCH_KEEP;
+ #ifdef FEAT_RELTIME
proftime_T tm;
+ #endif
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
save_cpo = p_cpo;
***************
*** 6188,6195 ****
pat = pat3;
for (;;)
{
n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
! options, RE_SEARCH, lnum_stop, &tm, NULL);
if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos)))
/* didn't find it or found the first match again: FAIL */
break;
--- 6196,6210 ----
pat = pat3;
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,
! options, RE_SEARCH, &sia);
if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos)))
/* didn't find it or found the first match again: FAIL */
break;
*** ../vim-8.1.2172/src/ex_docmd.c 2019-10-12 20:17:24.605773312 +0200
--- src/ex_docmd.c 2019-10-17 23:36:23.358189388 +0200
***************
*** 3600,3606 ****
curwin->w_cursor.col = 0;
searchcmdlen = 0;
flags = silent ? 0 : SEARCH_HIS | SEARCH_MSG;
! if (!do_search(NULL, c, cmd, 1L, flags, NULL, NULL))
{
curwin->w_cursor = pos;
cmd = NULL;
--- 3600,3606 ----
curwin->w_cursor.col = 0;
searchcmdlen = 0;
flags = silent ? 0 : SEARCH_HIS | SEARCH_MSG;
! if (!do_search(NULL, c, cmd, 1L, flags, NULL))
{
curwin->w_cursor = pos;
cmd = NULL;
***************
*** 3654,3661 ****
pos.coladd = 0;
if (searchit(curwin, curbuf, &pos, NULL,
*cmd == '?' ? BACKWARD : FORWARD,
! (char_u *)"", 1L, SEARCH_MSG,
! i, (linenr_T)0, NULL, NULL) != FAIL)
lnum = pos.lnum;
else
{
--- 3654,3660 ----
pos.coladd = 0;
if (searchit(curwin, curbuf, &pos, NULL,
*cmd == '?' ? BACKWARD : FORWARD,
! (char_u *)"", 1L, SEARCH_MSG, i, NULL) != FAIL)
lnum = pos.lnum;
else
{
*** ../vim-8.1.2172/src/gui.c 2019-09-15 13:16:55.208317441 +0200
--- src/gui.c 2019-10-17 23:39:00.109607473 +0200
***************
*** 5383,5389 ****
i = msg_scroll;
if (down)
{
! (void)do_search(NULL, '/', ga.ga_data, 1L, searchflags, NULL, NULL);
}
else
{
--- 5383,5389 ----
i = msg_scroll;
if (down)
{
! (void)do_search(NULL, '/', ga.ga_data, 1L, searchflags, NULL);
}
else
{
***************
*** 5391,5397 ****
* direction */
p = vim_strsave_escaped(ga.ga_data, (char_u *)"?");
if (p != NULL)
! (void)do_search(NULL, '?', p, 1L, searchflags, NULL, NULL);
vim_free(p);
}
--- 5391,5397 ----
* direction */
p = vim_strsave_escaped(ga.ga_data, (char_u *)"?");
if (p != NULL)
! (void)do_search(NULL, '?', p, 1L, searchflags, NULL);
vim_free(p);
}
*** ../vim-8.1.2172/src/quickfix.c 2019-10-16 14:51:36.512685665 +0200
--- src/quickfix.c 2019-10-17 23:39:17.037543984 +0200
***************
*** 3207,3214 ****
// Move the cursor to the first line in the buffer
save_cursor = curwin->w_cursor;
curwin->w_cursor.lnum = 0;
! if (!do_search(NULL, '/', qf_pattern, (long)1,
! SEARCH_KEEP, NULL, NULL))
curwin->w_cursor = save_cursor;
}
}
--- 3207,3213 ----
// Move the cursor to the first line in the buffer
save_cursor = curwin->w_cursor;
curwin->w_cursor.lnum = 0;
! if (!do_search(NULL, '/', qf_pattern, (long)1, SEARCH_KEEP, NULL))
curwin->w_cursor = save_cursor;
}
}
*** ../vim-8.1.2172/src/spell.c 2019-10-13 19:49:22.338551943 +0200
--- src/spell.c 2019-10-17 23:39:52.261411594 +0200
***************
*** 2861,2867 ****
curwin->w_cursor.lnum = 0;
while (!got_int)
{
! if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP, NULL, NULL) == 0
|| u_save_cursor() == FAIL)
break;
--- 2861,2867 ----
curwin->w_cursor.lnum = 0;
while (!got_int)
{
! if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP, NULL) == 0
|| u_save_cursor() == FAIL)
break;
*** ../vim-8.1.2172/src/tag.c 2019-10-15 22:23:34.199941450 +0200
--- src/tag.c 2019-10-17 23:40:12.721334449 +0200
***************
*** 3542,3548 ****
save_lnum = curwin->w_cursor.lnum;
curwin->w_cursor.lnum = 0; /* start search before first line */
if (do_search(NULL, pbuf[0], pbuf + 1, (long)1,
! search_options, NULL, NULL))
retval = OK;
else
{
--- 3542,3548 ----
save_lnum = curwin->w_cursor.lnum;
curwin->w_cursor.lnum = 0; /* start search before first line */
if (do_search(NULL, pbuf[0], pbuf + 1, (long)1,
! search_options, NULL))
retval = OK;
else
{
***************
*** 3554,3560 ****
*/
p_ic = TRUE;
if (!do_search(NULL, pbuf[0], pbuf + 1, (long)1,
! search_options, NULL, NULL))
{
/*
* Failed to find pattern, take a guess: "^func ("
--- 3554,3560 ----
*/
p_ic = TRUE;
if (!do_search(NULL, pbuf[0], pbuf + 1, (long)1,
! search_options, NULL))
{
/*
* Failed to find pattern, take a guess: "^func ("
***************
*** 3565,3577 ****
*tagp.tagname_end = NUL;
sprintf((char *)pbuf, "^%s\\s\\*(", tagp.tagname);
if (!do_search(NULL, '/', pbuf, (long)1,
! search_options, NULL, NULL))
{
/* Guess again: "^char * \<func (" */
sprintf((char *)pbuf, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(",
tagp.tagname);
if (!do_search(NULL, '/', pbuf, (long)1,
! search_options, NULL, NULL))
found = 0;
}
*tagp.tagname_end = cc;
--- 3565,3577 ----
*tagp.tagname_end = NUL;
sprintf((char *)pbuf, "^%s\\s\\*(", tagp.tagname);
if (!do_search(NULL, '/', pbuf, (long)1,
! search_options, NULL))
{
/* Guess again: "^char * \<func (" */
sprintf((char *)pbuf, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(",
tagp.tagname);
if (!do_search(NULL, '/', pbuf, (long)1,
! search_options, NULL))
found = 0;
}
*tagp.tagname_end = cc;
*** ../vim-8.1.2172/src/ex_getln.c 2019-10-17 22:58:59.062497024 +0200
--- src/ex_getln.c 2019-10-18 20:44:04.652979399 +0200
***************
*** 373,378 ****
--- 373,379 ----
pos_T end_pos;
#ifdef FEAT_RELTIME
proftime_T tm;
+ searchit_arg_T sia;
#endif
int next_char;
int use_last_pat;
***************
*** 445,456 ****
if (search_first_line != 0)
search_flags += SEARCH_START;
ccline.cmdbuff[skiplen + patlen] = NUL;
found = do_search(NULL, firstc == ':' ? '/' : firstc,
ccline.cmdbuff + skiplen, count, search_flags,
#ifdef FEAT_RELTIME
! &tm, NULL
#else
! NULL, NULL
#endif
);
ccline.cmdbuff[skiplen + patlen] = next_char;
--- 446,461 ----
if (search_first_line != 0)
search_flags += SEARCH_START;
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,
ccline.cmdbuff + skiplen, count, search_flags,
#ifdef FEAT_RELTIME
! &sia
#else
! NULL
#endif
);
ccline.cmdbuff[skiplen + patlen] = next_char;
***************
*** 597,604 ****
pat[patlen] = NUL;
i = searchit(curwin, curbuf, &t, NULL,
c == Ctrl_G ? FORWARD : BACKWARD,
! pat, count, search_flags,
! RE_SEARCH, 0, NULL, NULL);
--emsg_off;
pat[patlen] = save;
if (i)
--- 602,608 ----
pat[patlen] = NUL;
i = searchit(curwin, curbuf, &t, NULL,
c == Ctrl_G ? FORWARD : BACKWARD,
! pat, count, search_flags, RE_SEARCH, NULL);
--emsg_off;
pat[patlen] = save;
if (i)
*** ../vim-8.1.2172/src/insexpand.c 2019-09-28 19:04:06.993029586 +0200
--- src/insexpand.c 2019-10-17 23:18:02.490293326 +0200
***************
*** 2881,2887 ****
found_new_match = searchit(NULL, ins_buf, pos, NULL,
compl_direction,
compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG,
! RE_LAST, (linenr_T)0, NULL, NULL);
--msg_silent;
if (!compl_started || set_match_pos)
{
--- 2881,2887 ----
found_new_match = searchit(NULL, ins_buf, pos, NULL,
compl_direction,
compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG,
! RE_LAST, NULL);
--msg_silent;
if (!compl_started || set_match_pos)
{
*** ../vim-8.1.2172/src/normal.c 2019-10-17 22:58:59.066497012 +0200
--- src/normal.c 2019-10-18 20:42:41.624940971 +0200
***************
*** 65,71 ****
static void nv_dollar(cmdarg_T *cap);
static void nv_search(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 void nv_csearch(cmdarg_T *cap);
static void nv_brackets(cmdarg_T *cap);
static void nv_percent(cmdarg_T *cap);
--- 65,71 ----
static void nv_dollar(cmdarg_T *cap);
static void nv_search(cmdarg_T *cap);
static void nv_next(cmdarg_T *cap);
! 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_brackets(cmdarg_T *cap);
static void nv_percent(cmdarg_T *cap);
***************
*** 2346,2352 ****
for (;;)
{
t = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD,
! pat, 1L, searchflags, RE_LAST, (linenr_T)0, NULL, NULL);
if (curwin->w_cursor.lnum >= old_pos.lnum)
t = FAIL; /* match after start is failure too */
--- 2346,2352 ----
for (;;)
{
t = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD,
! pat, 1L, searchflags, RE_LAST, NULL);
if (curwin->w_cursor.lnum >= old_pos.lnum)
t = FAIL; /* match after start is failure too */
***************
*** 3730,3736 ****
init_history();
add_to_history(HIST_SEARCH, buf, TRUE, NUL);
! (void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0);
}
else
{
--- 3730,3736 ----
init_history();
add_to_history(HIST_SEARCH, buf, TRUE, NUL);
! (void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0, NULL);
}
else
{
***************
*** 4257,4263 ****
(void)normal_search(cap, cap->cmdchar, cap->searchbuf,
(cap->arg || !EQUAL_POS(save_cursor, curwin->w_cursor))
! ? 0 : SEARCH_MARK);
}
/*
--- 4257,4263 ----
(void)normal_search(cap, cap->cmdchar, cap->searchbuf,
(cap->arg || !EQUAL_POS(save_cursor, curwin->w_cursor))
! ? 0 : SEARCH_MARK, NULL);
}
/*
***************
*** 4267,4282 ****
static void
nv_next(cmdarg_T *cap)
{
! pos_T old = curwin->w_cursor;
! int i = normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg);
! if (i == 1 && EQUAL_POS(old, curwin->w_cursor))
{
/* Avoid getting stuck on the current cursor position, which can
* happen when an offset is given and the cursor is on the last char
* in the buffer: Repeat with count + 1. */
cap->count1 += 1;
! (void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg);
cap->count1 -= 1;
}
}
--- 4267,4283 ----
static void
nv_next(cmdarg_T *cap)
{
! pos_T old = curwin->w_cursor;
! int wrapped = FALSE;
! int i = normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg,
&wrapped);
! if (i == 1 && !wrapped && EQUAL_POS(old, curwin->w_cursor))
{
/* Avoid getting stuck on the current cursor position, which can
* happen when an offset is given and the cursor is on the last char
* in the buffer: Repeat with count + 1. */
cap->count1 += 1;
! (void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg, NULL);
cap->count1 -= 1;
}
}
***************
*** 4291,4307 ****
cmdarg_T *cap,
int dir,
char_u *pat,
! int opt) /* extra flags for do_search() */
{
int i;
cap->oap->motion_type = MCHAR;
cap->oap->inclusive = FALSE;
cap->oap->use_reg_one = TRUE;
curwin->w_set_curswant = TRUE;
i = do_search(cap->oap, dir, pat, cap->count1,
! opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, NULL, NULL);
if (i == 0)
clearop(cap->oap);
else
--- 4292,4313 ----
cmdarg_T *cap,
int dir,
char_u *pat,
! int opt, // extra flags for do_search()
! int *wrapped)
{
int i;
+ searchit_arg_T sia;
cap->oap->motion_type = MCHAR;
cap->oap->inclusive = FALSE;
cap->oap->use_reg_one = TRUE;
curwin->w_set_curswant = TRUE;
+ vim_memset(&sia, 0, sizeof(sia));
i = do_search(cap->oap, dir, pat, cap->count1,
! opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, &sia);
! if (wrapped != NULL)
! *wrapped = sia.sa_wrapped;
if (i == 0)
clearop(cap->oap);
else
*** ../vim-8.1.2172/src/version.c 2019-10-18 20:36:48.753171724 +0200
--- src/version.c 2019-10-18 20:51:09.141492864 +0200
***************
*** 743,744 ****
--- 743,746 ----
{ /* Add new patch number below this line */
+ /**/
+ 2173,
/**/
--
I am always surprised in the Linux world how quickly solutions can be
obtained. (Imagine sending an email to Bill Gates, asking why Windows
crashed, and how to fix it... and then getting an answer that fixed the
problem... <0>_<0> !) -- Mark Langdon
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201910181853.x9IIrxIk023249%40masaka.moolenaar.net.