]>
Commit | Line | Data |
---|---|---|
d1b4bd6a ER |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.2.407 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.2.407 | |
11 | Problem: When using an expression in ":s" backslashes in the result are | |
12 | dropped. (Sergey Goldgaber, Christian Brabandt) | |
13 | Solution: Double backslashes. | |
14 | Files: src/regexp.c | |
15 | ||
16 | ||
17 | *** ../vim-7.2.406/src/regexp.c 2009-11-26 20:41:19.000000000 +0100 | |
18 | --- src/regexp.c 2010-03-23 16:22:35.000000000 +0100 | |
19 | *************** | |
20 | *** 6963,6968 **** | |
21 | --- 6963,6970 ---- | |
22 | eval_result = eval_to_string(source + 2, NULL, TRUE); | |
23 | if (eval_result != NULL) | |
24 | { | |
25 | + int had_backslash = FALSE; | |
26 | + | |
27 | for (s = eval_result; *s != NUL; mb_ptr_adv(s)) | |
28 | { | |
29 | /* Change NL to CR, so that it becomes a line break. | |
30 | *************** | |
31 | *** 6970,6976 **** | |
32 | --- 6972,6991 ---- | |
33 | if (*s == NL) | |
34 | *s = CAR; | |
35 | else if (*s == '\\' && s[1] != NUL) | |
36 | + { | |
37 | ++s; | |
38 | + had_backslash = TRUE; | |
39 | + } | |
40 | + } | |
41 | + if (had_backslash && backslash) | |
42 | + { | |
43 | + /* Backslashes will be consumed, need to double them. */ | |
44 | + s = vim_strsave_escaped(eval_result, (char_u *)"\\"); | |
45 | + if (s != NULL) | |
46 | + { | |
47 | + vim_free(eval_result); | |
48 | + eval_result = s; | |
49 | + } | |
50 | } | |
51 | ||
52 | dst += STRLEN(eval_result); | |
53 | *** ../vim-7.2.406/src/version.c 2010-03-23 15:36:29.000000000 +0100 | |
54 | --- src/version.c 2010-03-23 16:26:22.000000000 +0100 | |
55 | *************** | |
56 | *** 683,684 **** | |
57 | --- 683,686 ---- | |
58 | { /* Add new patch number below this line */ | |
59 | + /**/ | |
60 | + 407, | |
61 | /**/ | |
62 | ||
63 | -- | |
64 | Sorry, no fortune today. | |
65 | ||
66 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
67 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
68 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
69 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |