version 1.28, 2013/09/24 13:29:51 |
version 1.29, 2013/12/20 18:44:13 |
|
|
static int |
static int |
re_forwsrch(void) |
re_forwsrch(void) |
{ |
{ |
int tbo, error; |
int tbo, tdotline, error; |
struct line *clp; |
struct line *clp; |
|
|
clp = curwp->w_dotp; |
clp = curwp->w_dotp; |
tbo = curwp->w_doto; |
tbo = curwp->w_doto; |
|
tdotline = curwp->w_dotline; |
|
|
if (tbo == clp->l_used) |
if (tbo == clp->l_used) |
/* |
/* |
|
|
*/ |
*/ |
if (clp != curbp->b_headp) { |
if (clp != curbp->b_headp) { |
clp = lforw(clp); |
clp = lforw(clp); |
|
tdotline++; |
tbo = 0; |
tbo = 0; |
} |
} |
/* |
/* |
|
|
REG_STARTEND); |
REG_STARTEND); |
if (error != 0) { |
if (error != 0) { |
clp = lforw(clp); |
clp = lforw(clp); |
|
tdotline++; |
tbo = 0; |
tbo = 0; |
} else { |
} else { |
curwp->w_doto = regex_match[0].rm_eo; |
curwp->w_doto = regex_match[0].rm_eo; |
curwp->w_dotp = clp; |
curwp->w_dotp = clp; |
|
curwp->w_dotline = tdotline; |
curwp->w_rflag |= WFMOVE; |
curwp->w_rflag |= WFMOVE; |
return (TRUE); |
return (TRUE); |
} |
} |
|
|
re_backsrch(void) |
re_backsrch(void) |
{ |
{ |
struct line *clp; |
struct line *clp; |
int tbo; |
int tbo, tdotline; |
regmatch_t lastmatch; |
regmatch_t lastmatch; |
|
|
clp = curwp->w_dotp; |
clp = curwp->w_dotp; |
tbo = curwp->w_doto; |
tbo = curwp->w_doto; |
|
tdotline = curwp->w_dotline; |
|
|
/* Start search one position to the left of dot */ |
/* Start search one position to the left of dot */ |
tbo = tbo - 1; |
tbo = tbo - 1; |
if (tbo < 0) { |
if (tbo < 0) { |
/* must move up one line */ |
/* must move up one line */ |
clp = lback(clp); |
clp = lback(clp); |
|
tdotline--; |
tbo = llength(clp); |
tbo = llength(clp); |
} |
} |
|
|
|
|
} |
} |
if (lastmatch.rm_so == -1) { |
if (lastmatch.rm_so == -1) { |
clp = lback(clp); |
clp = lback(clp); |
|
tdotline--; |
tbo = llength(clp); |
tbo = llength(clp); |
} else { |
} else { |
memcpy(®ex_match[0], &lastmatch, sizeof(regmatch_t)); |
memcpy(®ex_match[0], &lastmatch, sizeof(regmatch_t)); |
curwp->w_doto = regex_match[0].rm_so; |
curwp->w_doto = regex_match[0].rm_so; |
curwp->w_dotp = clp; |
curwp->w_dotp = clp; |
|
curwp->w_dotline = tdotline; |
curwp->w_rflag |= WFMOVE; |
curwp->w_rflag |= WFMOVE; |
return (TRUE); |
return (TRUE); |
} |
} |