astepano / rpms / vim

Forked from rpms/vim 6 years ago
Clone
f5f9f90
To: vim_dev@googlegroups.com
f5f9f90
Subject: Patch 7.4.276
f5f9f90
Fcc: outbox
f5f9f90
From: Bram Moolenaar <Bram@moolenaar.net>
f5f9f90
Mime-Version: 1.0
f5f9f90
Content-Type: text/plain; charset=UTF-8
f5f9f90
Content-Transfer-Encoding: 8bit
f5f9f90
------------
f5f9f90
f5f9f90
Patch 7.4.276
f5f9f90
Problem:    The fish shell is not supported.
f5f9f90
Solution:   Use begin/end instead of () for fish. (Andy Russell)
f5f9f90
Files:	    src/ex_cmds.c, src/misc1.c, src/option.c, src/proto/misc1.pro
f5f9f90
f5f9f90
f5f9f90
*** ../vim-7.4.275/src/ex_cmds.c	2014-05-07 14:38:41.129091709 +0200
f5f9f90
--- src/ex_cmds.c	2014-05-07 15:09:57.797108136 +0200
f5f9f90
***************
f5f9f90
*** 1551,1558 ****
f5f9f90
  {
f5f9f90
      char_u	*buf;
f5f9f90
      long_u	len;
f5f9f90
  
f5f9f90
!     len = (long_u)STRLEN(cmd) + 3;			/* "()" + NUL */
f5f9f90
      if (itmp != NULL)
f5f9f90
  	len += (long_u)STRLEN(itmp) + 9;		/* " { < " + " } " */
f5f9f90
      if (otmp != NULL)
f5f9f90
--- 1551,1566 ----
f5f9f90
  {
f5f9f90
      char_u	*buf;
f5f9f90
      long_u	len;
f5f9f90
+     int		is_fish_shell;
f5f9f90
  
f5f9f90
! #if (defined(UNIX) && !defined(ARCHIE)) || defined(OS2)
f5f9f90
!     /* Account for fish's different syntax for subshells */
f5f9f90
!     is_fish_shell = (fnamecmp(get_isolated_shell_name(), "fish") == 0);
f5f9f90
!     if (is_fish_shell)
f5f9f90
! 	len = (long_u)STRLEN(cmd) + 13;		/* "begin; " + "; end" + NUL */
f5f9f90
!     else
f5f9f90
! #endif
f5f9f90
! 	len = (long_u)STRLEN(cmd) + 3;			/* "()" + NUL */
f5f9f90
      if (itmp != NULL)
f5f9f90
  	len += (long_u)STRLEN(itmp) + 9;		/* " { < " + " } " */
f5f9f90
      if (otmp != NULL)
f5f9f90
***************
f5f9f90
*** 1567,1573 ****
f5f9f90
       * redirecting input and/or output.
f5f9f90
       */
f5f9f90
      if (itmp != NULL || otmp != NULL)
f5f9f90
! 	vim_snprintf((char *)buf, len, "(%s)", (char *)cmd);
f5f9f90
      else
f5f9f90
  	STRCPY(buf, cmd);
f5f9f90
      if (itmp != NULL)
f5f9f90
--- 1575,1586 ----
f5f9f90
       * redirecting input and/or output.
f5f9f90
       */
f5f9f90
      if (itmp != NULL || otmp != NULL)
f5f9f90
!     {
f5f9f90
! 	if (is_fish_shell)
f5f9f90
! 	    vim_snprintf((char *)buf, len, "begin; %s; end", (char *)cmd);
f5f9f90
! 	else
f5f9f90
! 	    vim_snprintf((char *)buf, len, "(%s)", (char *)cmd);
f5f9f90
!     }
f5f9f90
      else
f5f9f90
  	STRCPY(buf, cmd);
f5f9f90
      if (itmp != NULL)
f5f9f90
***************
f5f9f90
*** 1577,1583 ****
f5f9f90
      }
f5f9f90
  #else
f5f9f90
      /*
f5f9f90
!      * for shells that don't understand braces around commands, at least allow
f5f9f90
       * the use of commands in a pipe.
f5f9f90
       */
f5f9f90
      STRCPY(buf, cmd);
f5f9f90
--- 1590,1596 ----
f5f9f90
      }
f5f9f90
  #else
f5f9f90
      /*
f5f9f90
!      * For shells that don't understand braces around commands, at least allow
f5f9f90
       * the use of commands in a pipe.
f5f9f90
       */
f5f9f90
      STRCPY(buf, cmd);
f5f9f90
***************
f5f9f90
*** 4315,4321 ****
f5f9f90
      pos_T	old_cursor = curwin->w_cursor;
f5f9f90
      int		start_nsubs;
f5f9f90
  #ifdef FEAT_EVAL
f5f9f90
!     int         save_ma = 0;
f5f9f90
  #endif
f5f9f90
  
f5f9f90
      cmd = eap->arg;
f5f9f90
--- 4328,4334 ----
f5f9f90
      pos_T	old_cursor = curwin->w_cursor;
f5f9f90
      int		start_nsubs;
f5f9f90
  #ifdef FEAT_EVAL
f5f9f90
!     int		save_ma = 0;
f5f9f90
  #endif
f5f9f90
  
f5f9f90
      cmd = eap->arg;
f5f9f90
***************
f5f9f90
*** 5986,5992 ****
f5f9f90
  			       "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
f5f9f90
  			       "\\[count]", "\\[quotex]", "\\[range]",
f5f9f90
  			       "\\[pattern]", "\\\\bar", "/\\\\%\\$",
f5f9f90
!                                "s/\\\\\\~", "s/\\\\U", "s/\\\\L",
f5f9f90
  			       "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
f5f9f90
      int flags;
f5f9f90
  
f5f9f90
--- 5999,6005 ----
f5f9f90
  			       "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
f5f9f90
  			       "\\[count]", "\\[quotex]", "\\[range]",
f5f9f90
  			       "\\[pattern]", "\\\\bar", "/\\\\%\\$",
f5f9f90
! 			       "s/\\\\\\~", "s/\\\\U", "s/\\\\L",
f5f9f90
  			       "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
f5f9f90
      int flags;
f5f9f90
  
f5f9f90
***************
f5f9f90
*** 6026,6032 ****
f5f9f90
  	  /* Replace:
f5f9f90
  	   * "[:...:]" with "\[:...:]"
f5f9f90
  	   * "[++...]" with "\[++...]"
f5f9f90
! 	   * "\{" with "\\{"               -- matching "} \}"
f5f9f90
  	   */
f5f9f90
  	    if ((arg[0] == '[' && (arg[1] == ':'
f5f9f90
  			 || (arg[1] == '+' && arg[2] == '+')))
f5f9f90
--- 6039,6045 ----
f5f9f90
  	  /* Replace:
f5f9f90
  	   * "[:...:]" with "\[:...:]"
f5f9f90
  	   * "[++...]" with "\[++...]"
f5f9f90
! 	   * "\{" with "\\{"		   -- matching "} \}"
f5f9f90
  	   */
f5f9f90
  	    if ((arg[0] == '[' && (arg[1] == ':'
f5f9f90
  			 || (arg[1] == '+' && arg[2] == '+')))
f5f9f90
*** ../vim-7.4.275/src/misc1.c	2014-04-05 19:44:36.903160723 +0200
f5f9f90
--- src/misc1.c	2014-05-07 15:04:25.921105231 +0200
f5f9f90
***************
f5f9f90
*** 1405,1411 ****
f5f9f90
  #ifdef FEAT_SMARTINDENT
f5f9f90
  	if (did_si)
f5f9f90
  	{
f5f9f90
! 	    int        sw = (int)get_sw_value(curbuf);
f5f9f90
  
f5f9f90
  	    if (p_sr)
f5f9f90
  		newindent -= newindent % sw;
f5f9f90
--- 1405,1411 ----
f5f9f90
  #ifdef FEAT_SMARTINDENT
f5f9f90
  	if (did_si)
f5f9f90
  	{
f5f9f90
! 	    int sw = (int)get_sw_value(curbuf);
f5f9f90
  
f5f9f90
  	    if (p_sr)
f5f9f90
  		newindent -= newindent % sw;
f5f9f90
***************
f5f9f90
*** 10896,10898 ****
f5f9f90
--- 10896,10936 ----
f5f9f90
  {
f5f9f90
      return (p_im && stuff_empty() && typebuf_typed());
f5f9f90
  }
f5f9f90
+ 
f5f9f90
+ /*
f5f9f90
+  * Returns the isolated name of the shell:
f5f9f90
+  * - Skip beyond any path.  E.g., "/usr/bin/csh -f" -> "csh -f".
f5f9f90
+  * - Remove any argument.  E.g., "csh -f" -> "csh".
f5f9f90
+  * But don't allow a space in the path, so that this works:
f5f9f90
+  *   "/usr/bin/csh --rcfile ~/.cshrc"
f5f9f90
+  * But don't do that for Windows, it's common to have a space in the path.
f5f9f90
+  */
f5f9f90
+     char_u *
f5f9f90
+ get_isolated_shell_name()
f5f9f90
+ {
f5f9f90
+     char_u *p;
f5f9f90
+ 
f5f9f90
+ #ifdef WIN3264
f5f9f90
+     p = gettail(p_sh);
f5f9f90
+     p = vim_strnsave(p, (int)(skiptowhite(p) - p));
f5f9f90
+ #else
f5f9f90
+     p = skiptowhite(p_sh);
f5f9f90
+     if (*p == NUL)
f5f9f90
+     {
f5f9f90
+ 	/* No white space, use the tail. */
f5f9f90
+ 	p = vim_strsave(gettail(p_sh));
f5f9f90
+     }
f5f9f90
+     else
f5f9f90
+     {
f5f9f90
+ 	char_u  *p1, *p2;
f5f9f90
+ 
f5f9f90
+ 	/* Find the last path separator before the space. */
f5f9f90
+ 	p1 = p_sh;
f5f9f90
+ 	for (p2 = p_sh; p2 < p; mb_ptr_adv(p2))
f5f9f90
+ 	    if (vim_ispathsep(*p2))
f5f9f90
+ 		p1 = p2 + 1;
f5f9f90
+ 	p = vim_strnsave(p1, (int)(p - p1));
f5f9f90
+     }
f5f9f90
+ #endif
f5f9f90
+     return p;
f5f9f90
+ }
f5f9f90
*** ../vim-7.4.275/src/option.c	2014-03-23 15:12:29.931264336 +0100
f5f9f90
--- src/option.c	2014-05-07 15:05:14.117105653 +0200
f5f9f90
***************
f5f9f90
*** 3804,3840 ****
f5f9f90
      else
f5f9f90
  	do_sp = !(options[idx_sp].flags & P_WAS_SET);
f5f9f90
  #endif
f5f9f90
! 
f5f9f90
!     /*
f5f9f90
!      * Isolate the name of the shell:
f5f9f90
!      * - Skip beyond any path.  E.g., "/usr/bin/csh -f" -> "csh -f".
f5f9f90
!      * - Remove any argument.  E.g., "csh -f" -> "csh".
f5f9f90
!      * But don't allow a space in the path, so that this works:
f5f9f90
!      *   "/usr/bin/csh --rcfile ~/.cshrc"
f5f9f90
!      * But don't do that for Windows, it's common to have a space in the path.
f5f9f90
!      */
f5f9f90
! #ifdef WIN3264
f5f9f90
!     p = gettail(p_sh);
f5f9f90
!     p = vim_strnsave(p, (int)(skiptowhite(p) - p));
f5f9f90
! #else
f5f9f90
!     p = skiptowhite(p_sh);
f5f9f90
!     if (*p == NUL)
f5f9f90
!     {
f5f9f90
! 	/* No white space, use the tail. */
f5f9f90
! 	p = vim_strsave(gettail(p_sh));
f5f9f90
!     }
f5f9f90
!     else
f5f9f90
!     {
f5f9f90
! 	char_u  *p1, *p2;
f5f9f90
! 
f5f9f90
! 	/* Find the last path separator before the space. */
f5f9f90
! 	p1 = p_sh;
f5f9f90
! 	for (p2 = p_sh; p2 < p; mb_ptr_adv(p2))
f5f9f90
! 	    if (vim_ispathsep(*p2))
f5f9f90
! 		p1 = p2 + 1;
f5f9f90
! 	p = vim_strnsave(p1, (int)(p - p1));
f5f9f90
!     }
f5f9f90
! #endif
f5f9f90
      if (p != NULL)
f5f9f90
      {
f5f9f90
  	/*
f5f9f90
--- 3804,3810 ----
f5f9f90
      else
f5f9f90
  	do_sp = !(options[idx_sp].flags & P_WAS_SET);
f5f9f90
  #endif
f5f9f90
!     p = get_isolated_shell_name();
f5f9f90
      if (p != NULL)
f5f9f90
      {
f5f9f90
  	/*
f5f9f90
***************
f5f9f90
*** 3875,3880 ****
f5f9f90
--- 3845,3851 ----
f5f9f90
  		    || fnamecmp(p, "zsh") == 0
f5f9f90
  		    || fnamecmp(p, "zsh-beta") == 0
f5f9f90
  		    || fnamecmp(p, "bash") == 0
f5f9f90
+ 		    || fnamecmp(p, "fish") == 0
f5f9f90
  #  ifdef WIN3264
f5f9f90
  		    || fnamecmp(p, "cmd") == 0
f5f9f90
  		    || fnamecmp(p, "sh.exe") == 0
f5f9f90
***************
f5f9f90
*** 8858,8865 ****
f5f9f90
   * opt_type). Uses
f5f9f90
   *
f5f9f90
   * Returned flags:
f5f9f90
!  *       0 hidden or unknown option, also option that does not have requested 
f5f9f90
!  *         type (see SREQ_* in vim.h)
f5f9f90
   *  see SOPT_* in vim.h for other flags
f5f9f90
   *
f5f9f90
   * Possible opt_type values: see SREQ_* in vim.h
f5f9f90
--- 8829,8836 ----
f5f9f90
   * opt_type). Uses
f5f9f90
   *
f5f9f90
   * Returned flags:
f5f9f90
!  *       0 hidden or unknown option, also option that does not have requested
f5f9f90
!  *	   type (see SREQ_* in vim.h)
f5f9f90
   *  see SOPT_* in vim.h for other flags
f5f9f90
   *
f5f9f90
   * Possible opt_type values: see SREQ_* in vim.h
f5f9f90
*** ../vim-7.4.275/src/proto/misc1.pro	2014-04-05 19:44:36.903160723 +0200
f5f9f90
--- src/proto/misc1.pro	2014-05-07 14:57:04.605101368 +0200
f5f9f90
***************
f5f9f90
*** 103,106 ****
f5f9f90
--- 103,107 ----
f5f9f90
  char_u *get_cmd_output __ARGS((char_u *cmd, char_u *infile, int flags, int *ret_len));
f5f9f90
  void FreeWild __ARGS((int count, char_u **files));
f5f9f90
  int goto_im __ARGS((void));
f5f9f90
+ char_u *get_isolated_shell_name __ARGS((void));
f5f9f90
  /* vim: set ft=c : */
f5f9f90
*** ../vim-7.4.275/src/version.c	2014-05-07 14:38:41.129091709 +0200
f5f9f90
--- src/version.c	2014-05-07 14:58:59.769102376 +0200
f5f9f90
***************
f5f9f90
*** 736,737 ****
f5f9f90
--- 736,739 ----
f5f9f90
  {   /* Add new patch number below this line */
f5f9f90
+ /**/
f5f9f90
+     276,
f5f9f90
  /**/
f5f9f90
f5f9f90
-- 
f5f9f90
Support your right to bare arms!  Wear short sleeves!
f5f9f90
f5f9f90
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
f5f9f90
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
f5f9f90
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
f5f9f90
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///