jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone
3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.327
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.327
3ef2ca
Problem:    When 'verbose' is set to display the return value of a function,
3ef2ca
	    may get E724 repeatedly.
3ef2ca
Solution:   Do not give an error for verbose messages. Abort conversion to
3ef2ca
	    string after an error.
3ef2ca
Files:	    src/eval.c
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.326/src/eval.c	2014-06-12 18:39:16.828400409 +0200
3ef2ca
--- src/eval.c	2014-06-17 12:48:12.083946675 +0200
3ef2ca
***************
3ef2ca
*** 134,139 ****
3ef2ca
--- 134,142 ----
3ef2ca
  #define COPYID_INC 2
3ef2ca
  #define COPYID_MASK (~0x1)
3ef2ca
  
3ef2ca
+ /* Abort conversion to string after a recursion error. */
3ef2ca
+ static int  did_echo_string_emsg = FALSE;
3ef2ca
+ 
3ef2ca
  /*
3ef2ca
   * Array to hold the hashtab with variables local to each sourced script.
3ef2ca
   * Each item holds a variable (nameless) that points to the dict_T.
3ef2ca
***************
3ef2ca
*** 6686,6691 ****
3ef2ca
--- 6689,6696 ----
3ef2ca
  	}
3ef2ca
  
3ef2ca
  	line_breakcheck();
3ef2ca
+ 	if (did_echo_string_emsg)  /* recursion error, bail out */
3ef2ca
+ 	    break;
3ef2ca
      }
3ef2ca
  
3ef2ca
      /* Allocate result buffer with its total size, avoid re-allocation and
3ef2ca
***************
3ef2ca
*** 7460,7467 ****
3ef2ca
  	    if (s != NULL)
3ef2ca
  		ga_concat(&ga, s);
3ef2ca
  	    vim_free(tofree);
3ef2ca
! 	    if (s == NULL)
3ef2ca
  		break;
3ef2ca
  	}
3ef2ca
      }
3ef2ca
      if (todo > 0)
3ef2ca
--- 7465,7474 ----
3ef2ca
  	    if (s != NULL)
3ef2ca
  		ga_concat(&ga, s);
3ef2ca
  	    vim_free(tofree);
3ef2ca
! 	    if (s == NULL || did_echo_string_emsg)
3ef2ca
  		break;
3ef2ca
+ 	    line_breakcheck();
3ef2ca
+ 
3ef2ca
  	}
3ef2ca
      }
3ef2ca
      if (todo > 0)
3ef2ca
***************
3ef2ca
*** 7619,7627 ****
3ef2ca
  
3ef2ca
      if (recurse >= DICT_MAXNEST)
3ef2ca
      {
3ef2ca
! 	EMSG(_("E724: variable nested too deep for displaying"));
3ef2ca
  	*tofree = NULL;
3ef2ca
! 	return NULL;
3ef2ca
      }
3ef2ca
      ++recurse;
3ef2ca
  
3ef2ca
--- 7626,7641 ----
3ef2ca
  
3ef2ca
      if (recurse >= DICT_MAXNEST)
3ef2ca
      {
3ef2ca
! 	if (!did_echo_string_emsg)
3ef2ca
! 	{
3ef2ca
! 	    /* Only give this message once for a recursive call to avoid
3ef2ca
! 	     * flooding the user with errors.  And stop iterating over lists
3ef2ca
! 	     * and dicts. */
3ef2ca
! 	    did_echo_string_emsg = TRUE;
3ef2ca
! 	    EMSG(_("E724: variable nested too deep for displaying"));
3ef2ca
! 	}
3ef2ca
  	*tofree = NULL;
3ef2ca
! 	return (char_u *)"{E724}";
3ef2ca
      }
3ef2ca
      ++recurse;
3ef2ca
  
3ef2ca
***************
3ef2ca
*** 7689,7695 ****
3ef2ca
  	    *tofree = NULL;
3ef2ca
      }
3ef2ca
  
3ef2ca
!     --recurse;
3ef2ca
      return r;
3ef2ca
  }
3ef2ca
  
3ef2ca
--- 7703,7710 ----
3ef2ca
  	    *tofree = NULL;
3ef2ca
      }
3ef2ca
  
3ef2ca
!     if (--recurse == 0)
3ef2ca
! 	did_echo_string_emsg = FALSE;
3ef2ca
      return r;
3ef2ca
  }
3ef2ca
  
3ef2ca
***************
3ef2ca
*** 23303,23309 ****
3ef2ca
--- 23318,23327 ----
3ef2ca
  			msg_outnum((long)argvars[i].vval.v_number);
3ef2ca
  		    else
3ef2ca
  		    {
3ef2ca
+ 			/* Do not want errors such as E724 here. */
3ef2ca
+ 			++emsg_off;
3ef2ca
  			s = tv2string(&argvars[i], &tofree, numbuf2, 0);
3ef2ca
+ 			--emsg_off;
3ef2ca
  			if (s != NULL)
3ef2ca
  			{
3ef2ca
  			    if (vim_strsize(s) > MSG_BUF_CLEN)
3ef2ca
***************
3ef2ca
*** 23395,23402 ****
3ef2ca
  
3ef2ca
  	    /* The value may be very long.  Skip the middle part, so that we
3ef2ca
  	     * have some idea how it starts and ends. smsg() would always
3ef2ca
! 	     * truncate it at the end. */
3ef2ca
  	    s = tv2string(fc->rettv, &tofree, numbuf2, 0);
3ef2ca
  	    if (s != NULL)
3ef2ca
  	    {
3ef2ca
  		if (vim_strsize(s) > MSG_BUF_CLEN)
3ef2ca
--- 23413,23422 ----
3ef2ca
  
3ef2ca
  	    /* The value may be very long.  Skip the middle part, so that we
3ef2ca
  	     * have some idea how it starts and ends. smsg() would always
3ef2ca
! 	     * truncate it at the end. Don't want errors such as E724 here. */
3ef2ca
! 	    ++emsg_off;
3ef2ca
  	    s = tv2string(fc->rettv, &tofree, numbuf2, 0);
3ef2ca
+ 	    --emsg_off;
3ef2ca
  	    if (s != NULL)
3ef2ca
  	    {
3ef2ca
  		if (vim_strsize(s) > MSG_BUF_CLEN)
3ef2ca
*** ../vim-7.4.326/src/version.c	2014-06-14 12:53:27.394152699 +0200
3ef2ca
--- src/version.c	2014-06-17 12:41:45.019932032 +0200
3ef2ca
***************
3ef2ca
*** 736,737 ****
3ef2ca
--- 736,739 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     327,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
TALL KNIGHT: We shall say Ni! again to you if you do not appease us.
3ef2ca
ARTHUR:      All right!  What do you want?
3ef2ca
TALL KNIGHT: We want ... a shrubbery!
3ef2ca
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///