4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: ":s/foo\|\nbar/x/g" does not replace two times in "foo\nbar".
13 Solution: When the pattern can match a line break also try matching at the
14 NUL at the end of a line.
15 Files: src/ex_cmds.c, src/regexp.c
18 *** ../vim-6.2.452/src/ex_cmds.c Sun Apr 4 15:39:18 2004
19 --- src/ex_cmds.c Mon Apr 5 21:55:43 2004
22 * But ":s/\n/#/" is OK.
25 ! lastone = ((sub_firstline[matchcol] == NUL && nmatch <= 1)
26 || got_int || got_quit || !(do_all || do_again));
30 * But ":s/\n/#/" is OK.
33 ! /* We already know that we did the last subst when we are at
34 ! * the end of the line, except that a pattern like
35 ! * "bar\|\nfoo" may match at the NUL. */
36 ! lastone = ((sub_firstline[matchcol] == NUL && nmatch <= 1
37 ! && !re_multiline(regmatch.regprog))
38 || got_int || got_quit || !(do_all || do_again));
41 *** ../vim-6.2.452/src/regexp.c Sun Apr 4 15:39:18 2004
42 --- src/regexp.c Mon Apr 5 22:13:21 2004
45 static void regtail __ARGS((char_u *, char_u *));
46 static void regoptail __ARGS((char_u *, char_u *));
48 - #if defined(FEAT_SEARCH_EXTRA) || defined(PROTO)
50 * Return TRUE if compiled regular expression "prog" can match a line break.
56 return (prog->regflags & RF_HASNL);
61 * Return TRUE if compiled regular expression "prog" looks before the start
63 *** ../vim-6.2.452/src/version.c Mon Apr 5 21:24:08 2004
64 --- src/version.c Mon Apr 5 22:11:20 2004
68 { /* Add new patch number below this line */
74 Microsoft's definition of a boolean: TRUE, FALSE, MAYBE
75 "Embrace and extend"...?
77 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
78 /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
79 \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
80 \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///