summaryrefslogtreecommitdiff
path: root/src/normal.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-18 20:53:34 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-18 20:53:34 +0200
commit92ea26b925a0835badb0af2d5887238a4198cabb (patch)
tree0ed45513ea242aa5c252f84cc00cf59b155b38e3 /src/normal.c
parent7751d1d1a3d447d0d48f57f34e0da9f7c6ac433d (diff)
downloadvim-git-92ea26b925a0835badb0af2d5887238a4198cabb.tar.gz
patch 8.1.2173: searchit() has too many argumentsv8.1.2173
Problem: Searchit() has too many arguments. Solution: Move optional arguments to a struct. Add the "wrapped" argument.
Diffstat (limited to 'src/normal.c')
-rw-r--r--src/normal.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/normal.c b/src/normal.c
index 87754eb40..f66a97c34 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -65,7 +65,7 @@ static void nv_end(cmdarg_T *cap);
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 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,7 +2346,7 @@ find_decl(
for (;;)
{
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)
t = FAIL; /* match after start is failure too */
@@ -3730,7 +3730,7 @@ nv_ident(cmdarg_T *cap)
init_history();
add_to_history(HIST_SEARCH, buf, TRUE, NUL);
- (void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0);
+ (void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0, NULL);
}
else
{
@@ -4257,7 +4257,7 @@ nv_search(cmdarg_T *cap)
(void)normal_search(cap, cap->cmdchar, cap->searchbuf,
(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
nv_next(cmdarg_T *cap)
{
- pos_T old = curwin->w_cursor;
- int i = normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg);
+ pos_T old = curwin->w_cursor;
+ 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
* 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);
+ (void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg, NULL);
cap->count1 -= 1;
}
}
@@ -4291,17 +4292,22 @@ normal_search(
cmdarg_T *cap,
int dir,
char_u *pat,
- int opt) /* extra flags for do_search() */
+ 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, NULL, NULL);
+ opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, &sia);
+ if (wrapped != NULL)
+ *wrapped = sia.sa_wrapped;
if (i == 0)
clearop(cap->oap);
else