2 Subject: Patch 6.2.177 (extra)
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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
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
24 OLECHAR Buf[MAX_OLE_STR];
25 char VimCmd[MAX_OLE_STR];
29 // Prepend CTRL-\ CTRL-N to exit insert mode
32 ! VimCmdStart = VimCmd + 2;
35 ! // Update the current file in Vim if it has been modified
36 ! sprintf (VimCmdStart, ":up\n");
38 if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
43 OLECHAR Buf[MAX_OLE_STR];
44 + char FileNameTmp[MAX_OLE_STR];
45 char VimCmd[MAX_OLE_STR];
48 // Prepend CTRL-\ CTRL-N to exit insert mode
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");
58 if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
62 if (g_ChangeDir != CD_NONE)
63 VimChangeDir (VimOle, DispatchId, FileName);
65 ! // Make Vim open the file
66 ! sprintf (VimCmd, ":drop %S\n", (char*) FileName);
67 ! // Convert all \ to /
68 ! for (s = VimCmd; *s; ++s)
71 if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
75 if (g_ChangeDir != CD_NONE)
76 VimChangeDir (VimOle, DispatchId, FileName);
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);
83 ! for (p = FileNameTmp; *p != '\0' && s < FileNameTmp + MAX_OLE_STR - 4;
96 if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
101 CString StrFileName = FileName;
102 char Drive[_MAX_DRIVE];
104 _splitpath (StrFileName, Drive, Dir, NULL, NULL);
105 ! // Convert to unix path name format
106 ! for (char* s = Dir; *s; ++s)
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];
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));
121 CString StrFileName = FileName;
122 char Drive[_MAX_DRIVE];
124 + char DirUnix[_MAX_DIR * 2];
127 _splitpath (StrFileName, Drive, Dir, NULL, NULL);
129 ! // Convert to Unix path name format, escape spaces.
131 ! for (s = Dir; *s; ++s)
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];
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));
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
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"
163 CONTROL "&Open file in DevStudio editor simultaneously",
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"
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
177 { /* Add new patch number below this line */
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.
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 ///