4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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
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
20 if (*s == '%' || *s == '#' || *s == '<')
23 ! rettv->vval.v_string = eval_vars(s, &len, NULL, &errormsg, s);
28 if (*s == '%' || *s == '#' || *s == '<')
31 ! rettv->vval.v_string = eval_vars(s, s, &len, NULL, &errormsg, NULL);
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
46 /* Skip a regexp pattern for ":vimgrep[add] pat file..." */
50 * Try to find a match at this position.
52 ! repl = eval_vars(p, &srclen, &(eap->do_ecmd_lnum), errormsgp, eap->arg);
53 if (*errormsgp != NULL) /* error detected */
55 if (repl == NULL) /* no match found */
58 * Try to find a match at this position.
60 ! repl = eval_vars(p, eap->arg, &srclen, &(eap->do_ecmd_lnum),
61 ! errormsgp, &escaped);
62 if (*errormsgp != NULL) /* error detected */
64 if (repl == NULL) /* no match found */
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). */
75 && eap->cmdidx != CMD_bang
76 && eap->cmdidx != CMD_make
77 && eap->cmdidx != CMD_lmake
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).
91 && eap->cmdidx != CMD_bang
92 && eap->cmdidx != CMD_make
93 && eap->cmdidx != CMD_lmake
96 * number of characters to skip.
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 */
109 * number of characters to skip.
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
129 + if (escaped != NULL)
133 * Check if there is something to do.
140 + if (escaped != NULL)
142 #ifdef FEAT_MODIFY_FNAME
149 /* replace "<sfile>" with the sourced file name, and do ":" stuff */
150 ! repl = eval_vars(p, &srclen, NULL, &errormsg, result);
151 if (errormsg != NULL)
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)
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
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));
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
186 { /* Add new patch number below this line */
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...?
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 ///