]>
Commit | Line | Data |
---|---|---|
468bf62c AM |
1 | To: vim-dev@vim.org |
2 | Subject: patch 7.0.224 | |
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 7.0.224 | |
11 | Problem: When expanding "##" spaces are escaped twice. (Pavol Juhas) | |
12 | Solution: Don't escape the spaces that separate arguments. | |
13 | Files: src/eval.c, src/ex_docmd.c, src/proto/ex_docmd.pro | |
14 | ||
15 | ||
16 | *** ../vim-7.0.223/src/eval.c Tue Mar 27 10:20:59 2007 | |
17 | --- src/eval.c Tue Mar 27 16:47:56 2007 | |
18 | *************** | |
19 | *** 8924,8930 **** | |
20 | if (*s == '%' || *s == '#' || *s == '<') | |
21 | { | |
22 | ++emsg_off; | |
23 | ! rettv->vval.v_string = eval_vars(s, &len, NULL, &errormsg, s); | |
24 | --emsg_off; | |
25 | } | |
26 | else | |
27 | --- 8924,8930 ---- | |
28 | if (*s == '%' || *s == '#' || *s == '<') | |
29 | { | |
30 | ++emsg_off; | |
31 | ! rettv->vval.v_string = eval_vars(s, s, &len, NULL, &errormsg, NULL); | |
32 | --emsg_off; | |
33 | } | |
34 | else | |
35 | *** ../vim-7.0.223/src/ex_docmd.c Sun Mar 11 15:53:27 2007 | |
36 | --- src/ex_docmd.c Tue Mar 27 16:49:06 2007 | |
37 | *************** | |
38 | *** 4176,4181 **** | |
39 | --- 4177,4183 ---- | |
40 | int srclen; | |
41 | char_u *p; | |
42 | int n; | |
43 | + int escaped; | |
44 | ||
45 | #ifdef FEAT_QUICKFIX | |
46 | /* Skip a regexp pattern for ":vimgrep[add] pat file..." */ | |
47 | *************** | |
48 | *** 4216,4222 **** | |
49 | /* | |
50 | * Try to find a match at this position. | |
51 | */ | |
52 | ! repl = eval_vars(p, &srclen, &(eap->do_ecmd_lnum), errormsgp, eap->arg); | |
53 | if (*errormsgp != NULL) /* error detected */ | |
54 | return FAIL; | |
55 | if (repl == NULL) /* no match found */ | |
56 | --- 4218,4225 ---- | |
57 | /* | |
58 | * Try to find a match at this position. | |
59 | */ | |
60 | ! repl = eval_vars(p, eap->arg, &srclen, &(eap->do_ecmd_lnum), | |
61 | ! errormsgp, &escaped); | |
62 | if (*errormsgp != NULL) /* error detected */ | |
63 | return FAIL; | |
64 | if (repl == NULL) /* no match found */ | |
65 | *************** | |
66 | *** 4235,4245 **** | |
67 | vim_free(l); | |
68 | } | |
69 | ||
70 | ! /* Need to escape white space et al. with a backslash. Don't do this | |
71 | ! * for shell commands (may have to use quotes instead). Don't do this | |
72 | ! * for non-unix systems when there is a single argument (spaces don't | |
73 | ! * separate arguments then). */ | |
74 | if (!eap->usefilter | |
75 | && eap->cmdidx != CMD_bang | |
76 | && eap->cmdidx != CMD_make | |
77 | && eap->cmdidx != CMD_lmake | |
78 | --- 4238,4252 ---- | |
79 | vim_free(l); | |
80 | } | |
81 | ||
82 | ! /* Need to escape white space et al. with a backslash. | |
83 | ! * Don't do this for: | |
84 | ! * - replacement that already has been escaped: "##" | |
85 | ! * - shell commands (may have to use quotes instead). | |
86 | ! * - non-unix systems when there is a single argument (spaces don't | |
87 | ! * separate arguments then). | |
88 | ! */ | |
89 | if (!eap->usefilter | |
90 | + && !escaped | |
91 | && eap->cmdidx != CMD_bang | |
92 | && eap->cmdidx != CMD_make | |
93 | && eap->cmdidx != CMD_lmake | |
94 | *************** | |
95 | *** 9280,9291 **** | |
96 | * number of characters to skip. | |
97 | */ | |
98 | char_u * | |
99 | ! eval_vars(src, usedlen, lnump, errormsg, srcstart) | |
100 | char_u *src; /* pointer into commandline */ | |
101 | int *usedlen; /* characters after src that are used */ | |
102 | linenr_T *lnump; /* line number for :e command, or NULL */ | |
103 | char_u **errormsg; /* pointer to error message */ | |
104 | ! char_u *srcstart; /* beginning of valid memory for src */ | |
105 | { | |
106 | int i; | |
107 | char_u *s; | |
108 | --- 9289,9302 ---- | |
109 | * number of characters to skip. | |
110 | */ | |
111 | char_u * | |
112 | ! eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped) | |
113 | char_u *src; /* pointer into commandline */ | |
114 | + char_u *srcstart; /* beginning of valid memory for src */ | |
115 | int *usedlen; /* characters after src that are used */ | |
116 | linenr_T *lnump; /* line number for :e command, or NULL */ | |
117 | char_u **errormsg; /* pointer to error message */ | |
118 | ! int *escaped; /* return value has escaped white space (can | |
119 | ! * be NULL) */ | |
120 | { | |
121 | int i; | |
122 | char_u *s; | |
123 | *************** | |
124 | *** 9332,9337 **** | |
125 | --- 9343,9350 ---- | |
126 | #endif | |
127 | ||
128 | *errormsg = NULL; | |
129 | + if (escaped != NULL) | |
130 | + *escaped = FALSE; | |
131 | ||
132 | /* | |
133 | * Check if there is something to do. | |
134 | *************** | |
135 | *** 9407,9412 **** | |
136 | --- 9420,9427 ---- | |
137 | result = arg_all(); | |
138 | resultbuf = result; | |
139 | *usedlen = 2; | |
140 | + if (escaped != NULL) | |
141 | + *escaped = TRUE; | |
142 | #ifdef FEAT_MODIFY_FNAME | |
143 | skip_mod = TRUE; | |
144 | #endif | |
145 | *************** | |
146 | *** 9627,9633 **** | |
147 | else | |
148 | { | |
149 | /* replace "<sfile>" with the sourced file name, and do ":" stuff */ | |
150 | ! repl = eval_vars(p, &srclen, NULL, &errormsg, result); | |
151 | if (errormsg != NULL) | |
152 | { | |
153 | if (*errormsg) | |
154 | --- 9642,9648 ---- | |
155 | else | |
156 | { | |
157 | /* replace "<sfile>" with the sourced file name, and do ":" stuff */ | |
158 | ! repl = eval_vars(p, result, &srclen, NULL, &errormsg, NULL); | |
159 | if (errormsg != NULL) | |
160 | { | |
161 | if (*errormsg) | |
162 | *** ../vim-7.0.223/src/proto/ex_docmd.pro Fri Mar 24 23:02:09 2006 | |
163 | --- src/proto/ex_docmd.pro Tue Mar 27 16:50:04 2007 | |
164 | *************** | |
165 | *** 44,50 **** | |
166 | extern FILE *open_exfile __ARGS((char_u *fname, int forceit, char *mode)); | |
167 | extern void update_topline_cursor __ARGS((void)); | |
168 | extern void exec_normal_cmd __ARGS((char_u *cmd, int remap, int silent)); | |
169 | ! extern char_u *eval_vars __ARGS((char_u *src, int *usedlen, linenr_T *lnump, char_u **errormsg, char_u *srcstart)); | |
170 | extern char_u *expand_sfile __ARGS((char_u *arg)); | |
171 | extern int put_eol __ARGS((FILE *fd)); | |
172 | extern int put_line __ARGS((FILE *fd, char *s)); | |
173 | --- 44,50 ---- | |
174 | extern FILE *open_exfile __ARGS((char_u *fname, int forceit, char *mode)); | |
175 | extern void update_topline_cursor __ARGS((void)); | |
176 | extern void exec_normal_cmd __ARGS((char_u *cmd, int remap, int silent)); | |
177 | ! extern char_u *eval_vars __ARGS((char_u *src, char_u *srcstart, int *usedlen, linenr_T *lnump, char_u **errormsg, int *escaped)); | |
178 | extern char_u *expand_sfile __ARGS((char_u *arg)); | |
179 | extern int put_eol __ARGS((FILE *fd)); | |
180 | extern int put_line __ARGS((FILE *fd, char *s)); | |
181 | *** ../vim-7.0.223/src/version.c Tue Mar 27 12:43:30 2007 | |
182 | --- src/version.c Tue Mar 27 16:55:21 2007 | |
183 | *************** | |
184 | *** 668,669 **** | |
185 | --- 668,671 ---- | |
186 | { /* Add new patch number below this line */ | |
187 | + /**/ | |
188 | + 224, | |
189 | /**/ | |
190 | ||
191 | -- | |
192 | "Software is like sex... it's better when it's free." | |
193 | -- Linus Torvalds, initiator of the free Linux OS | |
194 | Makes me wonder what FSF stands for...? | |
195 | ||
196 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
197 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
198 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
199 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |