# HG changeset patch # User Bram Moolenaar # Date 1370203683 -7200 # Node ID fc4d7f02ea3ac731a9717438c72aba098b117e8e # Parent 7a2f465822c4312b4cfd115e9623118582dc124a updated for version 7.3.1104 Problem: New regexp engine does not handle "~". Solution: Add support for "~". diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -829,9 +829,26 @@ nfa_regatom() EMSGN(_(e_misplaced), no_Magic(c)); return FAIL; - case Magic('~'): /* previous substitute pattern */ - /* TODO: Not supported yet */ - return FAIL; + case Magic('~'): + { + char_u *lp; + + /* Previous substitute pattern. + * Generated as "\%(pattern\)". */ + if (reg_prev_sub == NULL) + { + EMSG(_(e_nopresub)); + return FAIL; + } + for (lp = reg_prev_sub; *lp != NUL; mb_cptr_adv(lp)) + { + EMIT(PTR2CHAR(lp)); + if (lp != reg_prev_sub) + EMIT(NFA_CONCAT); + } + EMIT(NFA_NOPEN); + break; + } case Magic('1'): case Magic('2'): diff --git a/src/testdir/test24.in b/src/testdir/test24.in index 80eb90bf699ba694167818d364d2e72c06880a45..7dfc1afdc6999616e5171f76f4ff34d92f7d9a2a GIT binary patch literal 1301 zc$|$>TXWJt6z+pB?vp>^)S)v74M`xFN=++hUwyDVw9^gFCM-=9vY1^;sMg=^UQ!4b zN14p-cRA;UxNJoC?TT%w}^U z(r8NIA)Te!gf)Y#M999wMTiQy2^?w=t_(M9HPTzH6pOd+GjJ@qc#?f{6!*`%#$m44 zStD5_SFhxr>nns$3a_nq<~kiS&T*t8Pi(Lp?K+`t-=k8p9z)!;?UF7O{nw+dMby?8jC}gW2s!~R)633T=1)x8f-ih-s*)vRy-Z( zjd@fVT86w-j#TRljbCkSll$@&$v3`xF!LpB{rdx6tSY|xG*D3hQ9n@Nf7t=-w%1JN kUM3z2y%;|Om2}Mlcz2GHBmmz(N2(JL$m1iBQ8f?x1H46>RsaA1 diff --git a/src/testdir/test24.ok b/src/testdir/test24.ok --- a/src/testdir/test24.ok +++ b/src/testdir/test24.ok @@ -27,3 +27,6 @@ xx foobar xA xx xx an A xx XX 9; YY 77; + xyz + bcd + BB diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1104, +/**/ 1103, /**/ 1102,