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.0.113 < prev    next >
Encoding:
Internet Message Format  |  2001-12-30  |  4.5 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0.113
  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.0.113
  11. Problem:    ":edit ~/fname" doesn't work if $HOME includes a space.  Also,
  12.         expanding wildcards with the shell may fail. (John Daniel)
  13. Solution:   Escape spaces with a backslash when needed.
  14. Files:        src/ex_docmd.c, src/misc1.c, src/proto/misc1.pro, src/os_unix.c
  15.  
  16.  
  17. *** ../vim60.112/src/ex_docmd.c    Sat Dec 15 21:56:10 2001
  18. --- src/ex_docmd.c    Mon Dec 31 17:28:09 2001
  19. ***************
  20. *** 3297,3303 ****
  21.               if (vim_strchr(eap->arg, '$') != NULL
  22.                   || vim_strchr(eap->arg, '~') != NULL)
  23.               {
  24. !             expand_env(eap->arg, NameBuff, MAXPATHL);
  25.               has_wildcards = mch_has_wildcard(NameBuff);
  26.               p = NameBuff;
  27.               }
  28. --- 3297,3303 ----
  29.               if (vim_strchr(eap->arg, '$') != NULL
  30.                   || vim_strchr(eap->arg, '~') != NULL)
  31.               {
  32. !             expand_env_esc(eap->arg, NameBuff, MAXPATHL, TRUE);
  33.               has_wildcards = mch_has_wildcard(NameBuff);
  34.               p = NameBuff;
  35.               }
  36. *** ../vim60.112/src/misc1.c    Tue Nov  6 19:43:29 2001
  37. --- src/misc1.c    Mon Dec 31 17:46:07 2001
  38. ***************
  39. *** 2834,2839 ****
  40. --- 2834,2849 ----
  41.       char_u    *dst;        /* where to put the result */
  42.       int        dstlen;        /* maximum length of the result */
  43.   {
  44. +     expand_env_esc(src, dst, dstlen, FALSE);
  45. + }
  46. +     void
  47. + expand_env_esc(src, dst, dstlen, esc)
  48. +     char_u    *src;        /* input string e.g. "$HOME/vim.hlp" */
  49. +     char_u    *dst;        /* where to put the result */
  50. +     int        dstlen;        /* maximum length of the result */
  51. +     int        esc;        /* escape spaces in expanded variables */
  52. + {
  53.       char_u    *tail;
  54.       int        c;
  55.       char_u    *var;
  56. ***************
  57. *** 2999,3004 ****
  58. --- 3009,3029 ----
  59.           var = NULL;
  60.           tail = (char_u *)"";    /* for gcc */
  61.   #endif /* UNIX || VMS */
  62. +         }
  63. +         /* If "var" contains white space, escape it with a backslash.
  64. +          * Required for ":e ~/tt" $HOME includes a space. */
  65. +         if (esc && var != NULL && vim_strpbrk(var, (char_u *)" \t") != NULL)
  66. +         {
  67. +         char_u    *p = vim_strsave_escaped(var, (char_u *)" \t");
  68. +         if (p != NULL)
  69. +         {
  70. +             if (mustfree)
  71. +             vim_free(var);
  72. +             var = p;
  73. +             mustfree = TRUE;
  74. +         }
  75.           }
  76.   
  77.           if (var != NULL && *var != NUL
  78. *** ../vim60.112/src/proto/misc1.pro    Tue Sep 25 21:49:20 2001
  79. --- src/proto/misc1.pro    Mon Dec 31 17:26:25 2001
  80. ***************
  81. *** 46,51 ****
  82. --- 46,52 ----
  83.   void vim_beep __ARGS((void));
  84.   void init_homedir __ARGS((void));
  85.   void expand_env __ARGS((char_u *src, char_u *dst, int dstlen));
  86. + void expand_env_esc __ARGS((char_u *src, char_u *dst, int dstlen, int esc));
  87.   char_u *vim_getenv __ARGS((char_u *name, int *mustfree));
  88.   char_u *expand_env_save __ARGS((char_u *src));
  89.   void vim_setenv __ARGS((char_u *name, char_u *val));
  90. *** ../vim60.112/src/os_unix.c    Wed Oct 31 14:21:02 2001
  91. --- src/os_unix.c    Mon Dec 31 17:41:29 2001
  92. ***************
  93. *** 4277,4289 ****
  94.       if (shell_style != STYLE_BT)
  95.       for (i = 0; i < num_pat; ++i)
  96.       {
  97. ! #ifdef USE_SYSTEM
  98. !         STRCAT(command, " \"");    /* need extra quotes because we */
  99. !         STRCAT(command, pat[i]);    /*     start the shell twice */
  100. !         STRCAT(command, "\"");
  101. ! #else
  102. !         STRCAT(command, " ");
  103. !         STRCAT(command, pat[i]);
  104.   #endif
  105.       }
  106.       if (flags & EW_SILENT)
  107. --- 4277,4299 ----
  108.       if (shell_style != STYLE_BT)
  109.       for (i = 0; i < num_pat; ++i)
  110.       {
  111. !         /* When using system() always add extra quotes, because the shell
  112. !          * is started twice.  Otherwise it's only needed when the pattern
  113. !          * includes spaces or single quotes. */
  114. ! #ifndef USE_SYSTEM
  115. !         if (vim_strpbrk(pat[i], " '") != NULL)
  116. ! #endif
  117. !         {
  118. !         STRCAT(command, " \"");
  119. !         STRCAT(command, pat[i]);
  120. !         STRCAT(command, "\"");
  121. !         }
  122. ! #ifndef USE_SYSTEM
  123. !         else
  124. !         {
  125. !         STRCAT(command, " ");
  126. !         STRCAT(command, pat[i]);
  127. !         }
  128.   #endif
  129.       }
  130.       if (flags & EW_SILENT)
  131. *** ../vim60.112/src/version.c    Mon Dec 31 16:49:06 2001
  132. --- src/version.c    Mon Dec 31 17:43:12 2001
  133. ***************
  134. *** 608,609 ****
  135. --- 608,611 ----
  136.   {   /* Add new patch number below this line */
  137. + /**/
  138. +     113,
  139.   /**/
  140.  
  141. -- 
  142. Microsoft: "Windows NT 4.0 now has the same user-interface as Windows 95"
  143.     Windows 95: "Press CTRL-ALT-DEL to reboot"
  144. Windows NT 4.0: "Press CTRL-ALT-DEL to login"
  145.  
  146.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  147. (((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
  148.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  149.