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 / 7.4 / 7.4.276 < prev    next >
Encoding:
Internet Message Format  |  2014-05-06  |  8.4 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.4.276
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.4.276
  11. Problem:    The fish shell is not supported.
  12. Solution:   Use begin/end instead of () for fish. (Andy Russell)
  13. Files:        src/ex_cmds.c, src/misc1.c, src/option.c, src/proto/misc1.pro
  14.  
  15.  
  16. *** ../vim-7.4.275/src/ex_cmds.c    2014-05-07 14:38:41.129091709 +0200
  17. --- src/ex_cmds.c    2014-05-07 15:09:57.797108136 +0200
  18. ***************
  19. *** 1551,1558 ****
  20.   {
  21.       char_u    *buf;
  22.       long_u    len;
  23.   
  24. !     len = (long_u)STRLEN(cmd) + 3;            /* "()" + NUL */
  25.       if (itmp != NULL)
  26.       len += (long_u)STRLEN(itmp) + 9;        /* " { < " + " } " */
  27.       if (otmp != NULL)
  28. --- 1551,1566 ----
  29.   {
  30.       char_u    *buf;
  31.       long_u    len;
  32. +     int        is_fish_shell;
  33.   
  34. ! #if (defined(UNIX) && !defined(ARCHIE)) || defined(OS2)
  35. !     /* Account for fish's different syntax for subshells */
  36. !     is_fish_shell = (fnamecmp(get_isolated_shell_name(), "fish") == 0);
  37. !     if (is_fish_shell)
  38. !     len = (long_u)STRLEN(cmd) + 13;        /* "begin; " + "; end" + NUL */
  39. !     else
  40. ! #endif
  41. !     len = (long_u)STRLEN(cmd) + 3;            /* "()" + NUL */
  42.       if (itmp != NULL)
  43.       len += (long_u)STRLEN(itmp) + 9;        /* " { < " + " } " */
  44.       if (otmp != NULL)
  45. ***************
  46. *** 1567,1573 ****
  47.        * redirecting input and/or output.
  48.        */
  49.       if (itmp != NULL || otmp != NULL)
  50. !     vim_snprintf((char *)buf, len, "(%s)", (char *)cmd);
  51.       else
  52.       STRCPY(buf, cmd);
  53.       if (itmp != NULL)
  54. --- 1575,1586 ----
  55.        * redirecting input and/or output.
  56.        */
  57.       if (itmp != NULL || otmp != NULL)
  58. !     {
  59. !     if (is_fish_shell)
  60. !         vim_snprintf((char *)buf, len, "begin; %s; end", (char *)cmd);
  61. !     else
  62. !         vim_snprintf((char *)buf, len, "(%s)", (char *)cmd);
  63. !     }
  64.       else
  65.       STRCPY(buf, cmd);
  66.       if (itmp != NULL)
  67. ***************
  68. *** 1577,1583 ****
  69.       }
  70.   #else
  71.       /*
  72. !      * for shells that don't understand braces around commands, at least allow
  73.        * the use of commands in a pipe.
  74.        */
  75.       STRCPY(buf, cmd);
  76. --- 1590,1596 ----
  77.       }
  78.   #else
  79.       /*
  80. !      * For shells that don't understand braces around commands, at least allow
  81.        * the use of commands in a pipe.
  82.        */
  83.       STRCPY(buf, cmd);
  84. ***************
  85. *** 4315,4321 ****
  86.       pos_T    old_cursor = curwin->w_cursor;
  87.       int        start_nsubs;
  88.   #ifdef FEAT_EVAL
  89. !     int         save_ma = 0;
  90.   #endif
  91.   
  92.       cmd = eap->arg;
  93. --- 4328,4334 ----
  94.       pos_T    old_cursor = curwin->w_cursor;
  95.       int        start_nsubs;
  96.   #ifdef FEAT_EVAL
  97. !     int        save_ma = 0;
  98.   #endif
  99.   
  100.       cmd = eap->arg;
  101. ***************
  102. *** 5986,5992 ****
  103.                      "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
  104.                      "\\[count]", "\\[quotex]", "\\[range]",
  105.                      "\\[pattern]", "\\\\bar", "/\\\\%\\$",
  106. !                                "s/\\\\\\~", "s/\\\\U", "s/\\\\L",
  107.                      "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
  108.       int flags;
  109.   
  110. --- 5999,6005 ----
  111.                      "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
  112.                      "\\[count]", "\\[quotex]", "\\[range]",
  113.                      "\\[pattern]", "\\\\bar", "/\\\\%\\$",
  114. !                    "s/\\\\\\~", "s/\\\\U", "s/\\\\L",
  115.                      "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
  116.       int flags;
  117.   
  118. ***************
  119. *** 6026,6032 ****
  120.         /* Replace:
  121.          * "[:...:]" with "\[:...:]"
  122.          * "[++...]" with "\[++...]"
  123. !        * "\{" with "\\{"               -- matching "} \}"
  124.          */
  125.           if ((arg[0] == '[' && (arg[1] == ':'
  126.                || (arg[1] == '+' && arg[2] == '+')))
  127. --- 6039,6045 ----
  128.         /* Replace:
  129.          * "[:...:]" with "\[:...:]"
  130.          * "[++...]" with "\[++...]"
  131. !        * "\{" with "\\{"           -- matching "} \}"
  132.          */
  133.           if ((arg[0] == '[' && (arg[1] == ':'
  134.                || (arg[1] == '+' && arg[2] == '+')))
  135. *** ../vim-7.4.275/src/misc1.c    2014-04-05 19:44:36.903160723 +0200
  136. --- src/misc1.c    2014-05-07 15:04:25.921105231 +0200
  137. ***************
  138. *** 1405,1411 ****
  139.   #ifdef FEAT_SMARTINDENT
  140.       if (did_si)
  141.       {
  142. !         int        sw = (int)get_sw_value(curbuf);
  143.   
  144.           if (p_sr)
  145.           newindent -= newindent % sw;
  146. --- 1405,1411 ----
  147.   #ifdef FEAT_SMARTINDENT
  148.       if (did_si)
  149.       {
  150. !         int sw = (int)get_sw_value(curbuf);
  151.   
  152.           if (p_sr)
  153.           newindent -= newindent % sw;
  154. ***************
  155. *** 10896,10898 ****
  156. --- 10896,10936 ----
  157.   {
  158.       return (p_im && stuff_empty() && typebuf_typed());
  159.   }
  160. + /*
  161. +  * Returns the isolated name of the shell:
  162. +  * - Skip beyond any path.  E.g., "/usr/bin/csh -f" -> "csh -f".
  163. +  * - Remove any argument.  E.g., "csh -f" -> "csh".
  164. +  * But don't allow a space in the path, so that this works:
  165. +  *   "/usr/bin/csh --rcfile ~/.cshrc"
  166. +  * But don't do that for Windows, it's common to have a space in the path.
  167. +  */
  168. +     char_u *
  169. + get_isolated_shell_name()
  170. + {
  171. +     char_u *p;
  172. + #ifdef WIN3264
  173. +     p = gettail(p_sh);
  174. +     p = vim_strnsave(p, (int)(skiptowhite(p) - p));
  175. + #else
  176. +     p = skiptowhite(p_sh);
  177. +     if (*p == NUL)
  178. +     {
  179. +     /* No white space, use the tail. */
  180. +     p = vim_strsave(gettail(p_sh));
  181. +     }
  182. +     else
  183. +     {
  184. +     char_u  *p1, *p2;
  185. +     /* Find the last path separator before the space. */
  186. +     p1 = p_sh;
  187. +     for (p2 = p_sh; p2 < p; mb_ptr_adv(p2))
  188. +         if (vim_ispathsep(*p2))
  189. +         p1 = p2 + 1;
  190. +     p = vim_strnsave(p1, (int)(p - p1));
  191. +     }
  192. + #endif
  193. +     return p;
  194. + }
  195. *** ../vim-7.4.275/src/option.c    2014-03-23 15:12:29.931264336 +0100
  196. --- src/option.c    2014-05-07 15:05:14.117105653 +0200
  197. ***************
  198. *** 3804,3840 ****
  199.       else
  200.       do_sp = !(options[idx_sp].flags & P_WAS_SET);
  201.   #endif
  202. !     /*
  203. !      * Isolate the name of the shell:
  204. !      * - Skip beyond any path.  E.g., "/usr/bin/csh -f" -> "csh -f".
  205. !      * - Remove any argument.  E.g., "csh -f" -> "csh".
  206. !      * But don't allow a space in the path, so that this works:
  207. !      *   "/usr/bin/csh --rcfile ~/.cshrc"
  208. !      * But don't do that for Windows, it's common to have a space in the path.
  209. !      */
  210. ! #ifdef WIN3264
  211. !     p = gettail(p_sh);
  212. !     p = vim_strnsave(p, (int)(skiptowhite(p) - p));
  213. ! #else
  214. !     p = skiptowhite(p_sh);
  215. !     if (*p == NUL)
  216. !     {
  217. !     /* No white space, use the tail. */
  218. !     p = vim_strsave(gettail(p_sh));
  219. !     }
  220. !     else
  221. !     {
  222. !     char_u  *p1, *p2;
  223. !     /* Find the last path separator before the space. */
  224. !     p1 = p_sh;
  225. !     for (p2 = p_sh; p2 < p; mb_ptr_adv(p2))
  226. !         if (vim_ispathsep(*p2))
  227. !         p1 = p2 + 1;
  228. !     p = vim_strnsave(p1, (int)(p - p1));
  229. !     }
  230. ! #endif
  231.       if (p != NULL)
  232.       {
  233.       /*
  234. --- 3804,3810 ----
  235.       else
  236.       do_sp = !(options[idx_sp].flags & P_WAS_SET);
  237.   #endif
  238. !     p = get_isolated_shell_name();
  239.       if (p != NULL)
  240.       {
  241.       /*
  242. ***************
  243. *** 3875,3880 ****
  244. --- 3845,3851 ----
  245.               || fnamecmp(p, "zsh") == 0
  246.               || fnamecmp(p, "zsh-beta") == 0
  247.               || fnamecmp(p, "bash") == 0
  248. +             || fnamecmp(p, "fish") == 0
  249.   #  ifdef WIN3264
  250.               || fnamecmp(p, "cmd") == 0
  251.               || fnamecmp(p, "sh.exe") == 0
  252. ***************
  253. *** 8858,8865 ****
  254.    * opt_type). Uses
  255.    *
  256.    * Returned flags:
  257. !  *       0 hidden or unknown option, also option that does not have requested 
  258. !  *         type (see SREQ_* in vim.h)
  259.    *  see SOPT_* in vim.h for other flags
  260.    *
  261.    * Possible opt_type values: see SREQ_* in vim.h
  262. --- 8829,8836 ----
  263.    * opt_type). Uses
  264.    *
  265.    * Returned flags:
  266. !  *       0 hidden or unknown option, also option that does not have requested
  267. !  *       type (see SREQ_* in vim.h)
  268.    *  see SOPT_* in vim.h for other flags
  269.    *
  270.    * Possible opt_type values: see SREQ_* in vim.h
  271. *** ../vim-7.4.275/src/proto/misc1.pro    2014-04-05 19:44:36.903160723 +0200
  272. --- src/proto/misc1.pro    2014-05-07 14:57:04.605101368 +0200
  273. ***************
  274. *** 103,106 ****
  275. --- 103,107 ----
  276.   char_u *get_cmd_output __ARGS((char_u *cmd, char_u *infile, int flags, int *ret_len));
  277.   void FreeWild __ARGS((int count, char_u **files));
  278.   int goto_im __ARGS((void));
  279. + char_u *get_isolated_shell_name __ARGS((void));
  280.   /* vim: set ft=c : */
  281. *** ../vim-7.4.275/src/version.c    2014-05-07 14:38:41.129091709 +0200
  282. --- src/version.c    2014-05-07 14:58:59.769102376 +0200
  283. ***************
  284. *** 736,737 ****
  285. --- 736,739 ----
  286.   {   /* Add new patch number below this line */
  287. + /**/
  288. +     276,
  289.   /**/
  290.  
  291. -- 
  292. Support your right to bare arms!  Wear short sleeves!
  293.  
  294.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  295. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  296. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  297.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  298.