jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.539

3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.539
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.539 (after 7.4.530)
3ef2ca
Problem:    Crash when computing buffer count.  Problem with range for user
3ef2ca
	    commands.  Line range wrong in Visual area.
3ef2ca
Solution:   Avoid segfault in compute_buffer_local_count().  Check for
3ef2ca
	    CMD_USER when checking type of range. (Marcin Szamotulski)
3ef2ca
Files:	    runtime/doc/windows.txt, src/ex_docmd.c
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.538/runtime/doc/windows.txt	2014-11-27 16:22:42.738413084 +0100
3ef2ca
--- runtime/doc/windows.txt	2014-11-30 14:34:30.241835431 +0100
3ef2ca
***************
3ef2ca
*** 1026,1032 ****
3ef2ca
  		Actually, the buffer isn't completely deleted, it is removed
3ef2ca
  		from the buffer list |unlisted-buffer| and option values,
3ef2ca
  		variables and mappings/abbreviations for the buffer are
3ef2ca
! 		cleared.
3ef2ca
  
3ef2ca
  :bdelete[!] {bufname}						*E93* *E94*
3ef2ca
  		Like ":bdelete[!] [N]", but buffer given by name.  Note that a
3ef2ca
--- 1029,1039 ----
3ef2ca
  		Actually, the buffer isn't completely deleted, it is removed
3ef2ca
  		from the buffer list |unlisted-buffer| and option values,
3ef2ca
  		variables and mappings/abbreviations for the buffer are
3ef2ca
! 		cleared. Examples: >
3ef2ca
! 		    :.,$-bdelete    " delete buffers from the current one to
3ef2ca
! 				    " last but one
3ef2ca
! 		    :%bdelete	    " delete all buffers
3ef2ca
! <
3ef2ca
  
3ef2ca
  :bdelete[!] {bufname}						*E93* *E94*
3ef2ca
  		Like ":bdelete[!] [N]", but buffer given by name.  Note that a
3ef2ca
***************
3ef2ca
*** 1050,1056 ****
3ef2ca
  		Like |:bdelete|, but really delete the buffer.  Everything
3ef2ca
  		related to the buffer is lost.  All marks in this buffer
3ef2ca
  		become invalid, option settings are lost, etc.  Don't use this
3ef2ca
! 		unless you know what you are doing.
3ef2ca
  
3ef2ca
  :[N]bun[load][!]				*:bun* *:bunload* *E515*
3ef2ca
  :bun[load][!] [N]
3ef2ca
--- 1057,1067 ----
3ef2ca
  		Like |:bdelete|, but really delete the buffer.  Everything
3ef2ca
  		related to the buffer is lost.  All marks in this buffer
3ef2ca
  		become invalid, option settings are lost, etc.  Don't use this
3ef2ca
! 		unless you know what you are doing. Examples: >
3ef2ca
! 		    :.+,$bwipeout   " wipe out all buffers after the current
3ef2ca
! 				    " one
3ef2ca
! 		    :%bwipeout	    " wipe out all buffers
3ef2ca
! <
3ef2ca
  
3ef2ca
  :[N]bun[load][!]				*:bun* *:bunload* *E515*
3ef2ca
  :bun[load][!] [N]
3ef2ca
*** ../vim-7.4.538/src/ex_docmd.c	2014-11-27 18:32:58.528564550 +0100
3ef2ca
--- src/ex_docmd.c	2014-11-30 14:40:28.521847466 +0100
3ef2ca
***************
3ef2ca
*** 1694,1699 ****
3ef2ca
--- 1694,1700 ----
3ef2ca
      int	    offset;
3ef2ca
  {
3ef2ca
      buf_T   *buf;
3ef2ca
+     buf_T   *nextbuf;
3ef2ca
      int     count = offset;
3ef2ca
  
3ef2ca
      buf = firstbuf;
3ef2ca
***************
3ef2ca
*** 1701,1715 ****
3ef2ca
  	buf = buf->b_next;
3ef2ca
      while (count != 0)
3ef2ca
      {
3ef2ca
! 	count += (count < 0) ? 1 : -1;
3ef2ca
! 	if (buf->b_prev == NULL)
3ef2ca
  	    break;
3ef2ca
! 	buf = (count < 0) ? buf->b_prev : buf->b_next;
3ef2ca
  	if (addr_type == ADDR_LOADED_BUFFERS)
3ef2ca
  	    /* skip over unloaded buffers */
3ef2ca
! 	    while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL)
3ef2ca
! 		buf = (count < 0) ? buf->b_prev : buf->b_next;
3ef2ca
      }
3ef2ca
      return buf->b_fnum;
3ef2ca
  }
3ef2ca
  
3ef2ca
--- 1702,1731 ----
3ef2ca
  	buf = buf->b_next;
3ef2ca
      while (count != 0)
3ef2ca
      {
3ef2ca
! 	count += (offset < 0) ? 1 : -1;
3ef2ca
! 	nextbuf = (offset < 0) ? buf->b_prev : buf->b_next;
3ef2ca
! 	if (nextbuf == NULL)
3ef2ca
  	    break;
3ef2ca
! 	buf = nextbuf;
3ef2ca
  	if (addr_type == ADDR_LOADED_BUFFERS)
3ef2ca
  	    /* skip over unloaded buffers */
3ef2ca
! 	    while (buf->b_ml.ml_mfp == NULL)
3ef2ca
! 	    {
3ef2ca
! 		nextbuf = (offset < 0) ? buf->b_prev : buf->b_next;
3ef2ca
! 		if (nextbuf == NULL)
3ef2ca
! 		    break;
3ef2ca
! 		buf = nextbuf;
3ef2ca
! 	    }
3ef2ca
      }
3ef2ca
+     /* we might have gone too far, last buffer is not loadedd */
3ef2ca
+     if (addr_type == ADDR_LOADED_BUFFERS)
3ef2ca
+ 	while (buf->b_ml.ml_mfp == NULL)
3ef2ca
+ 	{
3ef2ca
+ 	    nextbuf = (offset >= 0) ? buf->b_prev : buf->b_next;
3ef2ca
+ 	    if (nextbuf == NULL)
3ef2ca
+ 		break;
3ef2ca
+ 	    buf = nextbuf;
3ef2ca
+ 	}
3ef2ca
      return buf->b_fnum;
3ef2ca
  }
3ef2ca
  
3ef2ca
***************
3ef2ca
*** 2113,2119 ****
3ef2ca
   * is equal to the lower.
3ef2ca
   */
3ef2ca
  
3ef2ca
!     if (ea.cmdidx != CMD_SIZE)
3ef2ca
  	ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type;
3ef2ca
      else
3ef2ca
  	ea.addr_type = ADDR_LINES;
3ef2ca
--- 2129,2135 ----
3ef2ca
   * is equal to the lower.
3ef2ca
   */
3ef2ca
  
3ef2ca
!     if (ea.cmdidx != CMD_USER && ea.cmdidx != CMD_SIZE)
3ef2ca
  	ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type;
3ef2ca
      else
3ef2ca
  	ea.addr_type = ADDR_LINES;
3ef2ca
***************
3ef2ca
*** 2153,2158 ****
3ef2ca
--- 2169,2175 ----
3ef2ca
  	{
3ef2ca
  	    if (*ea.cmd == '%')		    /* '%' - all lines */
3ef2ca
  	    {
3ef2ca
+ 		buf_T	*buf;
3ef2ca
  		++ea.cmd;
3ef2ca
  		switch (ea.addr_type)
3ef2ca
  		{
3ef2ca
***************
3ef2ca
*** 2160,2168 ****
3ef2ca
  			ea.line1 = 1;
3ef2ca
  			ea.line2 = curbuf->b_ml.ml_line_count;
3ef2ca
  			break;
3ef2ca
- 		    case ADDR_WINDOWS:
3ef2ca
  		    case ADDR_LOADED_BUFFERS:
3ef2ca
  		    case ADDR_UNLOADED_BUFFERS:
3ef2ca
  		    case ADDR_TABS:
3ef2ca
  			errormsg = (char_u *)_(e_invrange);
3ef2ca
  			goto doend;
3ef2ca
--- 2177,2197 ----
3ef2ca
  			ea.line1 = 1;
3ef2ca
  			ea.line2 = curbuf->b_ml.ml_line_count;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_LOADED_BUFFERS:
3ef2ca
+ 			buf = firstbuf;
3ef2ca
+ 			while (buf->b_next != NULL && buf->b_ml.ml_mfp == NULL)
3ef2ca
+ 			    buf = buf->b_next;
3ef2ca
+ 			ea.line1 = buf->b_fnum;
3ef2ca
+ 			buf = lastbuf;
3ef2ca
+ 			while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL)
3ef2ca
+ 			    buf = buf->b_prev;
3ef2ca
+ 			ea.line2 = buf->b_fnum;
3ef2ca
+ 			break;
3ef2ca
  		    case ADDR_UNLOADED_BUFFERS:
3ef2ca
+ 			ea.line1 = firstbuf->b_fnum;
3ef2ca
+ 			ea.line2 = lastbuf->b_fnum;
3ef2ca
+ 			break;
3ef2ca
+ 		    case ADDR_WINDOWS:
3ef2ca
  		    case ADDR_TABS:
3ef2ca
  			errormsg = (char_u *)_(e_invrange);
3ef2ca
  			goto doend;
3ef2ca
***************
3ef2ca
*** 4463,4469 ****
3ef2ca
  		n = getdigits(&cmd);
3ef2ca
  	    if (addr_type == ADDR_LOADED_BUFFERS
3ef2ca
  		    || addr_type == ADDR_UNLOADED_BUFFERS)
3ef2ca
! 		lnum = compute_buffer_local_count(addr_type, lnum, n);
3ef2ca
  	    else if (i == '-')
3ef2ca
  		lnum -= n;
3ef2ca
  	    else
3ef2ca
--- 4492,4498 ----
3ef2ca
  		n = getdigits(&cmd);
3ef2ca
  	    if (addr_type == ADDR_LOADED_BUFFERS
3ef2ca
  		    || addr_type == ADDR_UNLOADED_BUFFERS)
3ef2ca
! 		lnum = compute_buffer_local_count(addr_type, lnum, (i == '-') ? -1 * n : n);
3ef2ca
  	    else if (i == '-')
3ef2ca
  		lnum -= n;
3ef2ca
  	    else
3ef2ca
***************
3ef2ca
*** 4485,4493 ****
3ef2ca
  			lnum = 0;
3ef2ca
  			break;
3ef2ca
  		    }
3ef2ca
! 		    c = LAST_TAB_NR;
3ef2ca
! 		    if (lnum >= c)
3ef2ca
! 			lnum = c;
3ef2ca
  		    break;
3ef2ca
  		case ADDR_WINDOWS:
3ef2ca
  		    if (lnum < 0)
3ef2ca
--- 4514,4521 ----
3ef2ca
  			lnum = 0;
3ef2ca
  			break;
3ef2ca
  		    }
3ef2ca
! 		    if (lnum >= LAST_TAB_NR)
3ef2ca
! 			lnum = LAST_TAB_NR;
3ef2ca
  		    break;
3ef2ca
  		case ADDR_WINDOWS:
3ef2ca
  		    if (lnum < 0)
3ef2ca
***************
3ef2ca
*** 4495,4503 ****
3ef2ca
  			lnum = 0;
3ef2ca
  			break;
3ef2ca
  		    }
3ef2ca
! 		    c = LAST_WIN_NR;
3ef2ca
! 		    if (lnum > c)
3ef2ca
! 			lnum = c;
3ef2ca
  		    break;
3ef2ca
  		case ADDR_LOADED_BUFFERS:
3ef2ca
  		case ADDR_UNLOADED_BUFFERS:
3ef2ca
--- 4523,4530 ----
3ef2ca
  			lnum = 0;
3ef2ca
  			break;
3ef2ca
  		    }
3ef2ca
! 		    if (lnum >= LAST_WIN_NR)
3ef2ca
! 			lnum = LAST_WIN_NR;
3ef2ca
  		    break;
3ef2ca
  		case ADDR_LOADED_BUFFERS:
3ef2ca
  		case ADDR_UNLOADED_BUFFERS:
3ef2ca
*** ../vim-7.4.538/src/version.c	2014-11-30 13:34:16.893626683 +0100
3ef2ca
--- src/version.c	2014-11-30 14:33:29.622510487 +0100
3ef2ca
***************
3ef2ca
*** 743,744 ****
3ef2ca
--- 743,746 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     539,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
SOLDIER: What?  Ridden on a horse?
3ef2ca
ARTHUR:  Yes!
3ef2ca
SOLDIER: You're using coconuts!
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    ///