Fix rematch()
Rematch() was incremnenting the last match always, even in the cases when it was not matching anything. This patch detects this situation and it updates it only when there is a match.
This commit is contained in:
parent
78fd6ff239
commit
54ad6d512b
9
ed.c
9
ed.c
|
@ -404,8 +404,13 @@ match(int num)
|
|||
static int
|
||||
rematch(int num)
|
||||
{
|
||||
lastmatch += matchs[0].rm_eo;
|
||||
return !regexec(pattern, lastmatch, 10, matchs, 0);
|
||||
regoff_t off = matchs[0].rm_eo;
|
||||
|
||||
if (!regexec(pattern, lastmatch + off, 10, matchs, 0)) {
|
||||
lastmatch += off;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Reference in New Issue
Block a user