To: vim-dev@vim.org Subject: Patch 6.2.453 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.453 Problem: ":s/foo\|\nbar/x/g" does not replace two times in "foo\nbar". (Pavel Papushev) Solution: When the pattern can match a line break also try matching at the NUL at the end of a line. Files: src/ex_cmds.c, src/regexp.c *** ../vim-6.2.452/src/ex_cmds.c Sun Apr 4 15:39:18 2004 --- src/ex_cmds.c Mon Apr 5 21:55:43 2004 *************** *** 4094,4100 **** * But ":s/\n/#/" is OK. */ skip: ! lastone = ((sub_firstline[matchcol] == NUL && nmatch <= 1) || got_int || got_quit || !(do_all || do_again)); nmatch = -1; --- 4094,4104 ---- * But ":s/\n/#/" is OK. */ skip: ! /* We already know that we did the last subst when we are at ! * the end of the line, except that a pattern like ! * "bar\|\nfoo" may match at the NUL. */ ! lastone = ((sub_firstline[matchcol] == NUL && nmatch <= 1 ! && !re_multiline(regmatch.regprog)) || got_int || got_quit || !(do_all || do_again)); nmatch = -1; *** ../vim-6.2.452/src/regexp.c Sun Apr 4 15:39:18 2004 --- src/regexp.c Mon Apr 5 22:13:21 2004 *************** *** 701,707 **** static void regtail __ARGS((char_u *, char_u *)); static void regoptail __ARGS((char_u *, char_u *)); - #if defined(FEAT_SEARCH_EXTRA) || defined(PROTO) /* * Return TRUE if compiled regular expression "prog" can match a line break. */ --- 701,706 ---- *************** *** 711,717 **** { return (prog->regflags & RF_HASNL); } - #endif /* * Return TRUE if compiled regular expression "prog" looks before the start --- 710,715 ---- *** ../vim-6.2.452/src/version.c Mon Apr 5 21:24:08 2004 --- src/version.c Mon Apr 5 22:11:20 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 453, /**/ -- Microsoft's definition of a boolean: TRUE, FALSE, MAYBE "Embrace and extend"...? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///