]>
Commit | Line | Data |
---|---|---|
d02ad552 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.177 (extra) | |
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.177 (extra) | |
11 | Problem: VisVim: Opening a file with a space in the name doesn't work. (Rob | |
12 | Retter) Arbitrary commands are being executed. (Neil Bird) | |
13 | Solution: Put a backslash in front of every space in the file name. | |
14 | (Gerard Blais) Terminate the CTRL-\ CTRL-N command with a NUL. | |
15 | Files: src/VisVim/Commands.cpp, src/VisVim/VisVim.rc | |
16 | ||
17 | ||
18 | *** ../vim-6.2.176/src/VisVim/Commands.cpp Sat Sep 7 17:03:06 2002 | |
19 | --- src/VisVim/Commands.cpp Fri Jan 9 11:04:58 2004 | |
20 | *************** | |
21 | *** 512,529 **** | |
22 | goto OleError; | |
23 | ||
24 | OLECHAR Buf[MAX_OLE_STR]; | |
25 | char VimCmd[MAX_OLE_STR]; | |
26 | ! char* VimCmdStart; | |
27 | ! char* s; | |
28 | ||
29 | // Prepend CTRL-\ CTRL-N to exit insert mode | |
30 | VimCmd[0] = 0x1c; | |
31 | VimCmd[1] = 0x0e; | |
32 | ! VimCmdStart = VimCmd + 2; | |
33 | ||
34 | #ifdef SINGLE_WINDOW | |
35 | ! // Update the current file in Vim if it has been modified | |
36 | ! sprintf (VimCmdStart, ":up\n"); | |
37 | #endif | |
38 | if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf))) | |
39 | goto OleError; | |
40 | --- 512,530 ---- | |
41 | goto OleError; | |
42 | ||
43 | OLECHAR Buf[MAX_OLE_STR]; | |
44 | + char FileNameTmp[MAX_OLE_STR]; | |
45 | char VimCmd[MAX_OLE_STR]; | |
46 | ! char *s, *p; | |
47 | ||
48 | // Prepend CTRL-\ CTRL-N to exit insert mode | |
49 | VimCmd[0] = 0x1c; | |
50 | VimCmd[1] = 0x0e; | |
51 | ! VimCmd[2] = 0; | |
52 | ||
53 | #ifdef SINGLE_WINDOW | |
54 | ! // Update the current file in Vim if it has been modified. | |
55 | ! // Disabled, because it could write the file when you don't want to. | |
56 | ! sprintf (VimCmd + 2, ":up\n"); | |
57 | #endif | |
58 | if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf))) | |
59 | goto OleError; | |
60 | *************** | |
61 | *** 532,543 **** | |
62 | if (g_ChangeDir != CD_NONE) | |
63 | VimChangeDir (VimOle, DispatchId, FileName); | |
64 | ||
65 | ! // Make Vim open the file | |
66 | ! sprintf (VimCmd, ":drop %S\n", (char*) FileName); | |
67 | ! // Convert all \ to / | |
68 | ! for (s = VimCmd; *s; ++s) | |
69 | ! if (*s == '\\') | |
70 | ! *s = '/'; | |
71 | if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf))) | |
72 | goto OleError; | |
73 | ||
74 | --- 533,556 ---- | |
75 | if (g_ChangeDir != CD_NONE) | |
76 | VimChangeDir (VimOle, DispatchId, FileName); | |
77 | ||
78 | ! // Make Vim open the file. | |
79 | ! // In the filename convert all \ to /, put a \ before a space. | |
80 | ! sprintf(VimCmd, ":drop "); | |
81 | ! sprintf(FileNameTmp, "%S", (char *)FileName); | |
82 | ! s = VimCmd + 6; | |
83 | ! for (p = FileNameTmp; *p != '\0' && s < FileNameTmp + MAX_OLE_STR - 4; | |
84 | ! ++p) | |
85 | ! if (*p == '\\') | |
86 | ! *s++ = '/'; | |
87 | ! else | |
88 | ! { | |
89 | ! if (*p == ' ') | |
90 | ! *s++ = '\\'; | |
91 | ! *s++ = *p; | |
92 | ! } | |
93 | ! *s++ = '\n'; | |
94 | ! *s = '\0'; | |
95 | ! | |
96 | if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf))) | |
97 | goto OleError; | |
98 | ||
99 | *************** | |
100 | *** 638,656 **** | |
101 | CString StrFileName = FileName; | |
102 | char Drive[_MAX_DRIVE]; | |
103 | char Dir[_MAX_DIR]; | |
104 | _splitpath (StrFileName, Drive, Dir, NULL, NULL); | |
105 | ! // Convert to unix path name format | |
106 | ! for (char* s = Dir; *s; ++s) | |
107 | if (*s == '\\') | |
108 | ! *s = '/'; | |
109 | ||
110 | // Construct the cd command; append /.. if cd to parent | |
111 | // directory and not in root directory | |
112 | OLECHAR Buf[MAX_OLE_STR]; | |
113 | char VimCmd[MAX_OLE_STR]; | |
114 | ||
115 | ! sprintf (VimCmd, ":cd %s%s%s\n", Drive, Dir, | |
116 | ! g_ChangeDir == CD_SOURCE_PARENT && Dir[1] ? ".." : ""); | |
117 | VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)); | |
118 | } | |
119 | ||
120 | --- 651,682 ---- | |
121 | CString StrFileName = FileName; | |
122 | char Drive[_MAX_DRIVE]; | |
123 | char Dir[_MAX_DIR]; | |
124 | + char DirUnix[_MAX_DIR * 2]; | |
125 | + char *s, *t; | |
126 | + | |
127 | _splitpath (StrFileName, Drive, Dir, NULL, NULL); | |
128 | ! | |
129 | ! // Convert to Unix path name format, escape spaces. | |
130 | ! t = DirUnix; | |
131 | ! for (s = Dir; *s; ++s) | |
132 | if (*s == '\\') | |
133 | ! *t++ = '/'; | |
134 | ! else | |
135 | ! { | |
136 | ! if (*s == ' ') | |
137 | ! *t++ = '\\'; | |
138 | ! *t++ = *s; | |
139 | ! } | |
140 | ! *t = '\0'; | |
141 | ! | |
142 | ||
143 | // Construct the cd command; append /.. if cd to parent | |
144 | // directory and not in root directory | |
145 | OLECHAR Buf[MAX_OLE_STR]; | |
146 | char VimCmd[MAX_OLE_STR]; | |
147 | ||
148 | ! sprintf (VimCmd, ":cd %s%s%s\n", Drive, DirUnix, | |
149 | ! g_ChangeDir == CD_SOURCE_PARENT && DirUnix[1] ? ".." : ""); | |
150 | VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)); | |
151 | } | |
152 | ||
153 | *** ../vim-6.2.176/src/VisVim/VisVim.rc Sat Mar 9 19:45:58 2002 | |
154 | --- src/VisVim/VisVim.rc Thu Jan 8 21:40:29 2004 | |
155 | *************** | |
156 | *** 116,122 **** | |
157 | ||
158 | IDD_ADDINMAIN DIALOG DISCARDABLE 0, 0, 178, 124 | |
159 | STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | |
160 | ! CAPTION "Vim Add-In 1.3a" | |
161 | FONT 8, "MS Sans Serif" | |
162 | BEGIN | |
163 | CONTROL "&Open file in DevStudio editor simultaneously", | |
164 | --- 116,122 ---- | |
165 | ||
166 | IDD_ADDINMAIN DIALOG DISCARDABLE 0, 0, 178, 124 | |
167 | STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | |
168 | ! CAPTION "Vim Add-In 1.4" | |
169 | FONT 8, "MS Sans Serif" | |
170 | BEGIN | |
171 | CONTROL "&Open file in DevStudio editor simultaneously", | |
172 | *** ../vim-6.2.176/src/version.c Fri Jan 9 15:02:40 2004 | |
173 | --- src/version.c Fri Jan 9 15:06:32 2004 | |
174 | *************** | |
175 | *** 639,640 **** | |
176 | --- 639,642 ---- | |
177 | { /* Add new patch number below this line */ | |
178 | + /**/ | |
179 | + 177, | |
180 | /**/ | |
181 | ||
182 | -- | |
183 | hundred-and-one symptoms of being an internet addict: | |
184 | 208. Your goals for the future are obtaining an T1 connection and | |
185 | a 130 gig hard drive. | |
186 | ||
187 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
188 | /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
189 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
190 | \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html /// |