home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.2.177 < prev    next >
Encoding:
Internet Message Format  |  2004-01-08  |  5.4 KB

  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.       if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
  96.           goto OleError;
  97.   
  98. ***************
  99. *** 638,656 ****
  100.       CString StrFileName = FileName;
  101.       char Drive[_MAX_DRIVE];
  102.       char Dir[_MAX_DIR];
  103.       _splitpath (StrFileName, Drive, Dir, NULL, NULL);
  104. !     // Convert to unix path name format
  105. !     for (char* s = Dir; *s; ++s)
  106.           if (*s == '\\')
  107. !             *s = '/';
  108.   
  109.       // Construct the cd command; append /.. if cd to parent
  110.       // directory and not in root directory
  111.       OLECHAR Buf[MAX_OLE_STR];
  112.       char VimCmd[MAX_OLE_STR];
  113.   
  114. !     sprintf (VimCmd, ":cd %s%s%s\n", Drive, Dir,
  115. !          g_ChangeDir == CD_SOURCE_PARENT && Dir[1] ? ".." : "");
  116.       VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf));
  117.   }
  118.   
  119. --- 651,682 ----
  120.       CString StrFileName = FileName;
  121.       char Drive[_MAX_DRIVE];
  122.       char Dir[_MAX_DIR];
  123. +     char DirUnix[_MAX_DIR * 2];
  124. +     char *s, *t;
  125.       _splitpath (StrFileName, Drive, Dir, NULL, NULL);
  126. !     // Convert to Unix path name format, escape spaces.
  127. !     t = DirUnix;
  128. !     for (s = Dir; *s; ++s)
  129.           if (*s == '\\')
  130. !             *t++ = '/';
  131. !         else
  132. !         {
  133. !             if (*s == ' ')
  134. !                 *t++ = '\\';
  135. !             *t++ = *s;
  136. !         }
  137. !     *t = '\0';
  138.   
  139.       // Construct the cd command; append /.. if cd to parent
  140.       // directory and not in root directory
  141.       OLECHAR Buf[MAX_OLE_STR];
  142.       char VimCmd[MAX_OLE_STR];
  143.   
  144. !     sprintf (VimCmd, ":cd %s%s%s\n", Drive, DirUnix,
  145. !          g_ChangeDir == CD_SOURCE_PARENT && DirUnix[1] ? ".." : "");
  146.       VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf));
  147.   }
  148.   
  149. *** ../vim-6.2.176/src/VisVim/VisVim.rc    Sat Mar  9 19:45:58 2002
  150. --- src/VisVim/VisVim.rc    Thu Jan  8 21:40:29 2004
  151. ***************
  152. *** 116,122 ****
  153.   
  154.   IDD_ADDINMAIN DIALOG DISCARDABLE  0, 0, 178, 124
  155.   STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  156. ! CAPTION "Vim Add-In 1.3a"
  157.   FONT 8, "MS Sans Serif"
  158.   BEGIN
  159.       CONTROL         "&Open file in DevStudio editor simultaneously",
  160. --- 116,122 ----
  161.   
  162.   IDD_ADDINMAIN DIALOG DISCARDABLE  0, 0, 178, 124
  163.   STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  164. ! CAPTION "Vim Add-In 1.4"
  165.   FONT 8, "MS Sans Serif"
  166.   BEGIN
  167.       CONTROL         "&Open file in DevStudio editor simultaneously",
  168. *** ../vim-6.2.176/src/version.c    Fri Jan  9 15:02:40 2004
  169. --- src/version.c    Fri Jan  9 15:06:32 2004
  170. ***************
  171. *** 639,640 ****
  172. --- 639,642 ----
  173.   {   /* Add new patch number below this line */
  174. + /**/
  175. +     177,
  176.   /**/
  177.  
  178. -- 
  179. hundred-and-one symptoms of being an internet addict:
  180. 208. Your goals for the future are obtaining an T1 connection and
  181.      a 130 gig hard drive.
  182.  
  183.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  184. ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  185. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  186.  \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///
  187.