]>
Commit | Line | Data |
---|---|---|
14b40f53 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.453 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 6.2.453 | |
11 | Problem: ":s/foo\|\nbar/x/g" does not replace two times in "foo\nbar". | |
12 | (Pavel Papushev) | |
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 | |
16 | ||
17 | ||
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 | |
20 | *************** | |
21 | *** 4094,4100 **** | |
22 | * But ":s/\n/#/" is OK. | |
23 | */ | |
24 | skip: | |
25 | ! lastone = ((sub_firstline[matchcol] == NUL && nmatch <= 1) | |
26 | || got_int || got_quit || !(do_all || do_again)); | |
27 | nmatch = -1; | |
28 | ||
29 | --- 4094,4104 ---- | |
30 | * But ":s/\n/#/" is OK. | |
31 | */ | |
32 | skip: | |
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)); | |
39 | nmatch = -1; | |
40 | ||
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 | |
43 | *************** | |
44 | *** 701,707 **** | |
45 | static void regtail __ARGS((char_u *, char_u *)); | |
46 | static void regoptail __ARGS((char_u *, char_u *)); | |
47 | ||
48 | - #if defined(FEAT_SEARCH_EXTRA) || defined(PROTO) | |
49 | /* | |
50 | * Return TRUE if compiled regular expression "prog" can match a line break. | |
51 | */ | |
52 | --- 701,706 ---- | |
53 | *************** | |
54 | *** 711,717 **** | |
55 | { | |
56 | return (prog->regflags & RF_HASNL); | |
57 | } | |
58 | - #endif | |
59 | ||
60 | /* | |
61 | * Return TRUE if compiled regular expression "prog" looks before the start | |
62 | --- 710,715 ---- | |
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 | |
65 | *************** | |
66 | *** 639,640 **** | |
67 | --- 639,642 ---- | |
68 | { /* Add new patch number below this line */ | |
69 | + /**/ | |
70 | + 453, | |
71 | /**/ | |
72 | ||
73 | -- | |
74 | Microsoft's definition of a boolean: TRUE, FALSE, MAYBE | |
75 | "Embrace and extend"...? | |
76 | ||
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 /// |