diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-07-25 20:46:57 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-07-25 20:46:57 +0000 |
commit | 231334e6efbf3a7f89183f8257e09492534a5f8c (patch) | |
tree | b28b269502f6374b49f3fed5814c746f2edd3517 /src/eval.c | |
parent | 027436338b4b3e746ae5087b8a01c7404619d97b (diff) | |
download | vim-git-231334e6efbf3a7f89183f8257e09492534a5f8c.tar.gz |
updated for version 7.0116v7.0116
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c index 40ec9f3e3..f18a3a95b 100644 --- a/src/eval.c +++ b/src/eval.c @@ -12724,6 +12724,7 @@ f_reverse(argvars, rettv) #define SP_NOMOVE 1 /* don't move cursor */ #define SP_REPEAT 2 /* repeat to find outer pair */ #define SP_RETCOUNT 4 /* return matchcount */ +#define SP_SETPCMARK 8 /* set previous context mark */ static int get_search_arg __ARGS((typval_T *varp, int *flagsp)); @@ -12761,6 +12762,7 @@ get_search_arg(varp, flagsp) case 'n': mask = SP_NOMOVE; break; case 'r': mask = SP_REPEAT; break; case 'm': mask = SP_RETCOUNT; break; + case 's': mask = SP_SETPCMARK; break; } if (mask == 0) { @@ -12799,7 +12801,14 @@ f_search(argvars, rettv) dir = get_search_arg(&argvars[1], &flags); /* may set p_ws */ if (dir == 0) goto theend; - if ((flags & ~SP_NOMOVE) != 0) + /* + * This function accepts only SP_NOMOVE and SP_SETPCMARK flags. + * Check to make sure only those flags are set. + * Also, Only the SP_NOMOVE or the SP_SETPCMARK flag can be set. Both + * flags cannot be set. Check for that condition also. + */ + if (((flags & ~(SP_NOMOVE | SP_SETPCMARK)) != 0) || + ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) { EMSG2(_(e_invarg2), get_tv_string(&argvars[1])); goto theend; @@ -12810,6 +12819,8 @@ f_search(argvars, rettv) SEARCH_KEEP, RE_SEARCH) != FAIL) { rettv->vval.v_number = pos.lnum; + if (flags & SP_SETPCMARK) + setpcmark(); curwin->w_cursor = pos; /* "/$" will put the cursor after the end of the line, may need to * correct that here */ @@ -12853,6 +12864,14 @@ f_searchpair(argvars, rettv) dir = get_search_arg(&argvars[3], &flags); /* may set p_ws */ if (dir == 0) goto theend; + /* + * Only one of the SP_NOMOVE or SP_SETPCMARK flags can be set. + */ + if ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK)) + { + EMSG2(_(e_invarg2), get_tv_string(&argvars[1])); + goto theend; + } /* Optional fifth argument: skip expresion */ if (argvars[3].v_type == VAR_UNKNOWN @@ -12980,6 +12999,8 @@ do_searchpair(spat, mpat, epat, dir, skip, flags) ++retval; else retval = pos.lnum; + if (flags & SP_SETPCMARK) + setpcmark(); curwin->w_cursor = pos; if (!(flags & SP_REPEAT)) break; |