diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-04-26 21:26:28 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-04-26 21:26:28 +0000 |
commit | 3587f599b0b8da18e090aa2b843f0229df4cb83b (patch) | |
tree | fc4a0cb6b4ef0f48535d4a5e5bcc652366fc2d37 /Src/pattern.c | |
parent | 1fc8484f05abd32b3d4009f2ab1f95e4d95c6b78 (diff) | |
download | zsh-3587f599b0b8da18e090aa2b843f0229df4cb83b.tar.gz zsh-3587f599b0b8da18e090aa2b843f0229df4cb83b.tar.xz zsh-3587f599b0b8da18e090aa2b843f0229df4cb83b.zip |
unposted: fix position of cursor on forward pattern searching
Diffstat (limited to 'Src/pattern.c')
-rw-r--r-- | Src/pattern.c | 10 |
1 files changed, 10 insertions, 0 deletions
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; |