version 1.1, 1996/09/07 21:40:24 |
version 1.2, 1996/09/21 06:23:19 |
|
|
static int last_no_scs = FALSE; |
static int last_no_scs = FALSE; |
static char_u *mr_pattern = NULL; /* pattern used by myregcomp() */ |
static char_u *mr_pattern = NULL; /* pattern used by myregcomp() */ |
|
|
static int want_start; /* looking for start of line? */ |
|
|
|
/* |
/* |
* Type used by find_pattern_in_path() to remember which included files have |
* Type used by find_pattern_in_path() to remember which included files have |
* been searched already. |
* been searched already. |
|
|
} |
} |
} |
} |
|
|
want_start = (*pat == '^'); /* looking for start of line? */ |
|
set_reg_ic(pat); /* tell the vim_regexec routine how to search */ |
set_reg_ic(pat); /* tell the vim_regexec routine how to search */ |
return vim_regcomp(pat); |
return vim_regcomp(pat); |
} |
} |
|
|
for ( ; lnum > 0 && lnum <= curbuf->b_ml.ml_line_count; |
for ( ; lnum > 0 && lnum <= curbuf->b_ml.ml_line_count; |
lnum += dir, at_first_line = FALSE) |
lnum += dir, at_first_line = FALSE) |
{ |
{ |
ptr = ml_get(lnum); |
|
/* forward search, first line */ |
|
if (dir == FORWARD && at_first_line && start_pos.col > 0 && |
|
want_start) |
|
continue; /* match not possible */ |
|
|
|
/* |
/* |
* Look for a match somewhere in the line. |
* Look for a match somewhere in the line. |
*/ |
*/ |
|
ptr = ml_get(lnum); |
if (vim_regexec(prog, ptr, TRUE)) |
if (vim_regexec(prog, ptr, TRUE)) |
{ |
{ |
match = prog->startp[0]; |
match = prog->startp[0]; |
|
|
/* |
/* |
* When *match == NUL the cursor will be put one back |
* When *match == NUL the cursor will be put one back |
* afterwards, compare with that position, otherwise |
* afterwards, compare with that position, otherwise |
* "/$" will get stuck on end of line. Same for |
* "/$" will get stuck on end of line. |
* matchend. |
|
*/ |
*/ |
while ((options & SEARCH_END) ? |
while ((options & SEARCH_END) ? |
((int)(matchend - ptr) - 1 - (int)(*matchend == NUL) < |
((int)(matchend - ptr) - 1 < |
(int)start_pos.col + extra_col) : |
(int)start_pos.col + extra_col) : |
((int)(match - ptr) - (int)(*match == NUL) < |
((int)(match - ptr) - (int)(*match == NUL) < |
(int)start_pos.col + extra_col)) |
(int)start_pos.col + extra_col)) |
|
|
if (!match_ok) |
if (!match_ok) |
continue; |
continue; |
} |
} |
if (dir == BACKWARD && !want_start) |
if (dir == BACKWARD) |
{ |
{ |
/* |
/* |
* Now, if there are multiple matches on this line, |
* Now, if there are multiple matches on this line, |
|
|
* If 'options & SEARCH_NOOF': don't add offset to position |
* If 'options & SEARCH_NOOF': don't add offset to position |
* If 'options & SEARCH_MARK': set previous context mark |
* If 'options & SEARCH_MARK': set previous context mark |
* If 'options & SEARCH_KEEP': keep previous search pattern |
* If 'options & SEARCH_KEEP': keep previous search pattern |
|
* If 'options & SEARCH_START': accept match at curpos itself |
* |
* |
* Careful: If lastoffline == TRUE and lastoff == 0 this makes the |
* Careful: If lastoffline == TRUE and lastoff == 0 this makes the |
* movement linewise without moving the match position. |
* movement linewise without moving the match position. |
|
|
|
|
c = searchit(&pos, dirc == '/' ? FORWARD : BACKWARD, searchstr, count, |
c = searchit(&pos, dirc == '/' ? FORWARD : BACKWARD, searchstr, count, |
lastend + (options & |
lastend + (options & |
(SEARCH_KEEP + SEARCH_HIS + SEARCH_MSG + |
(SEARCH_KEEP + SEARCH_HIS + SEARCH_MSG + SEARCH_START + |
((str != NULL && *str == ';') ? 0 : SEARCH_NOOF))), |
((str != NULL && *str == ';') ? 0 : SEARCH_NOOF))), |
2); |
2); |
if (dircp != NULL) |
if (dircp != NULL) |
|
|
} |
} |
else |
else |
if (getfile(0, files[depth].name, NULL, TRUE, |
if (getfile(0, files[depth].name, NULL, TRUE, |
files[depth].lnum) > 0) |
files[depth].lnum, FALSE) > 0) |
break; /* failed to jump to file */ |
break; /* failed to jump to file */ |
} |
} |
if (action != ACTION_SHOW) |
if (action != ACTION_SHOW) |