1
0
forked from aniani/vim

patch 7.4.984

Problem:    searchpos() always starts searching in the first column, which is
            not what some people expect. (Brett Stahlman)
Solution:   Add the 'z' flag: start at the specified column.
This commit is contained in:
Bram Moolenaar
2015-12-28 19:20:36 +01:00
parent a60824308c
commit ad4d8a192a
7 changed files with 59 additions and 11 deletions

View File

@@ -578,6 +578,7 @@ last_pat_prog(regmatch)
* if (options & SEARCH_KEEP) keep previous search pattern
* if (options & SEARCH_FOLD) match only once in a closed fold
* if (options & SEARCH_PEEK) check for typed char, cancel search
* if (options & SEARCH_COL) start at pos->col instead of zero
*
* Return FAIL (zero) for failure, non-zero for success.
* When FEAT_EVAL is defined, returns the index of the first matching
@@ -599,6 +600,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
{
int found;
linenr_T lnum; /* no init to shut up Apollo cc */
colnr_T col;
regmmatch_T regmatch;
char_u *ptr;
colnr_T matchcol;
@@ -711,12 +713,14 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
/*
* Look for a match somewhere in line "lnum".
*/
col = at_first_line && (options & SEARCH_COL) ? pos->col
: (colnr_T)0;
nmatched = vim_regexec_multi(&regmatch, win, buf,
lnum, (colnr_T)0,
lnum, col,
#ifdef FEAT_RELTIME
tm
tm
#else
NULL
NULL
#endif
);
/* Abort searching on an error (e.g., out of stack). */
@@ -1098,6 +1102,7 @@ set_vv_searchforward()
/*
* Return the number of the first subpat that matched.
* Return zero if none of them matched.
*/
static int
first_submatch(rp)