From 3587f599b0b8da18e090aa2b843f0229df4cb83b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sat, 26 Apr 2008 21:26:28 +0000 Subject: unposted: fix position of cursor on forward pattern searching --- Src/pattern.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Src/pattern.c') diff --git a/Src/pattern.c b/Src/pattern.c index 15b0bd746..c66f73451 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -1861,6 +1861,9 @@ pattrylen(Patprog prog, char *string, int len, int unmetalen, int offset) * backreferences. On entry, *nump should contain the maximum number * of positions to report. In this case the match, mbegin, mend * arrays are not altered. + * + * If nump is NULL but endp is not NULL, then *endp is set to the + * end position of the match, taking into account patinstart. */ /**/ @@ -2222,6 +2225,13 @@ pattryrefs(Patprog prog, char *string, int stringlen, int unmetalen, setaparam("mend", mendarr); } + if (!nump && endp) { + /* + * We just need the overall end position. + */ + *endp = CHARSUB(patinstart, patinput) + patoffset; + } + ret = 1; } else ret = 0; -- cgit 1.4.1