Karsten Hopp 2b3523
To: vim_dev@googlegroups.com
Karsten Hopp 2b3523
Subject: Patch 7.4.646
Karsten Hopp 2b3523
Fcc: outbox
Karsten Hopp 2b3523
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 2b3523
Mime-Version: 1.0
Karsten Hopp 2b3523
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 2b3523
Content-Transfer-Encoding: 8bit
Karsten Hopp 2b3523
------------
Karsten Hopp 2b3523
Karsten Hopp 2b3523
Patch 7.4.646
Karsten Hopp 2b3523
Problem:    ":bufdo" may start at a deleted buffer.
Karsten Hopp 2b3523
Solution:   Find the first not deleted buffer. (Shane Harper)
Karsten Hopp 2b3523
Files:	    src/ex_cmds2.c, src/testdir/test_command_count.in,
Karsten Hopp 2b3523
	    src/testdir/test_command_count.ok
Karsten Hopp 2b3523
Karsten Hopp 2b3523
Karsten Hopp 2b3523
*** ../vim-7.4.645/src/ex_cmds2.c	2015-01-07 16:52:53.506792420 +0100
Karsten Hopp 2b3523
--- src/ex_cmds2.c	2015-02-27 20:30:04.087096679 +0100
Karsten Hopp 2b3523
***************
Karsten Hopp 2b3523
*** 2440,2446 ****
Karsten Hopp 2b3523
      win_T	*wp;
Karsten Hopp 2b3523
      tabpage_T	*tp;
Karsten Hopp 2b3523
  #endif
Karsten Hopp 2b3523
!     buf_T	*buf;
Karsten Hopp 2b3523
      int		next_fnum = 0;
Karsten Hopp 2b3523
  #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
Karsten Hopp 2b3523
      char_u	*save_ei = NULL;
Karsten Hopp 2b3523
--- 2440,2446 ----
Karsten Hopp 2b3523
      win_T	*wp;
Karsten Hopp 2b3523
      tabpage_T	*tp;
Karsten Hopp 2b3523
  #endif
Karsten Hopp 2b3523
!     buf_T	*buf = curbuf;
Karsten Hopp 2b3523
      int		next_fnum = 0;
Karsten Hopp 2b3523
  #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
Karsten Hopp 2b3523
      char_u	*save_ei = NULL;
Karsten Hopp 2b3523
***************
Karsten Hopp 2b3523
*** 2493,2512 ****
Karsten Hopp 2b3523
  	    case CMD_argdo:
Karsten Hopp 2b3523
  		i = eap->line1 - 1;
Karsten Hopp 2b3523
  		break;
Karsten Hopp 2b3523
- 	    case CMD_bufdo:
Karsten Hopp 2b3523
- 		i = eap->line1;
Karsten Hopp 2b3523
- 		break;
Karsten Hopp 2b3523
  	    default:
Karsten Hopp 2b3523
  		break;
Karsten Hopp 2b3523
  	}
Karsten Hopp 2b3523
  	/* set pcmark now */
Karsten Hopp 2b3523
  	if (eap->cmdidx == CMD_bufdo)
Karsten Hopp 2b3523
! 	    goto_buffer(eap, DOBUF_FIRST, FORWARD, i);
Karsten Hopp 2b3523
  	else
Karsten Hopp 2b3523
  	    setpcmark();
Karsten Hopp 2b3523
  	listcmd_busy = TRUE;	    /* avoids setting pcmark below */
Karsten Hopp 2b3523
  
Karsten Hopp 2b3523
! 	while (!got_int)
Karsten Hopp 2b3523
  	{
Karsten Hopp 2b3523
  	    if (eap->cmdidx == CMD_argdo)
Karsten Hopp 2b3523
  	    {
Karsten Hopp 2b3523
--- 2493,2520 ----
Karsten Hopp 2b3523
  	    case CMD_argdo:
Karsten Hopp 2b3523
  		i = eap->line1 - 1;
Karsten Hopp 2b3523
  		break;
Karsten Hopp 2b3523
  	    default:
Karsten Hopp 2b3523
  		break;
Karsten Hopp 2b3523
  	}
Karsten Hopp 2b3523
  	/* set pcmark now */
Karsten Hopp 2b3523
  	if (eap->cmdidx == CMD_bufdo)
Karsten Hopp 2b3523
!         {
Karsten Hopp 2b3523
! 	    /* Advance to the first listed buffer after "eap->line1". */
Karsten Hopp 2b3523
!             for (buf = firstbuf; buf != NULL && (buf->b_fnum < eap->line1
Karsten Hopp 2b3523
! 					  || !buf->b_p_bl); buf = buf->b_next)
Karsten Hopp 2b3523
! 		if (buf->b_fnum > eap->line2)
Karsten Hopp 2b3523
! 		{
Karsten Hopp 2b3523
! 		    buf = NULL;
Karsten Hopp 2b3523
! 		    break;
Karsten Hopp 2b3523
! 		}
Karsten Hopp 2b3523
!             if (buf != NULL)
Karsten Hopp 2b3523
! 		goto_buffer(eap, DOBUF_FIRST, FORWARD, buf->b_fnum);
Karsten Hopp 2b3523
!         }
Karsten Hopp 2b3523
  	else
Karsten Hopp 2b3523
  	    setpcmark();
Karsten Hopp 2b3523
  	listcmd_busy = TRUE;	    /* avoids setting pcmark below */
Karsten Hopp 2b3523
  
Karsten Hopp 2b3523
! 	while (!got_int && buf != NULL)
Karsten Hopp 2b3523
  	{
Karsten Hopp 2b3523
  	    if (eap->cmdidx == CMD_argdo)
Karsten Hopp 2b3523
  	    {
Karsten Hopp 2b3523
*** ../vim-7.4.645/src/testdir/test_command_count.in	2015-01-27 13:28:42.472671261 +0100
Karsten Hopp 2b3523
--- src/testdir/test_command_count.in	2015-02-27 20:03:15.981409267 +0100
Karsten Hopp 2b3523
***************
Karsten Hopp 2b3523
*** 141,146 ****
Karsten Hopp 2b3523
--- 141,147 ----
Karsten Hopp 2b3523
  :let buffers = ''
Karsten Hopp 2b3523
  :.,$-bufdo let buffers .= ' '.bufnr('%')
Karsten Hopp 2b3523
  :call add(g:lines, 'bufdo:' . buffers)
Karsten Hopp 2b3523
+ :3bd
Karsten Hopp 2b3523
  :let buffers = ''
Karsten Hopp 2b3523
  :3,7bufdo let buffers .= ' '.bufnr('%')
Karsten Hopp 2b3523
  :call add(g:lines, 'bufdo:' . buffers)
Karsten Hopp 2b3523
*** ../vim-7.4.645/src/testdir/test_command_count.ok	2015-01-20 13:29:46.397315064 +0100
Karsten Hopp 2b3523
--- src/testdir/test_command_count.ok	2015-02-27 20:03:15.981409267 +0100
Karsten Hopp 2b3523
***************
Karsten Hopp 2b3523
*** 34,38 ****
Karsten Hopp 2b3523
  argdo: c d e
Karsten Hopp 2b3523
  windo: 2 3 4
Karsten Hopp 2b3523
  bufdo: 2 3 4 5 6 7 8 9 10 15
Karsten Hopp 2b3523
! bufdo: 3 4 5 6 7
Karsten Hopp 2b3523
  tabdo: 2 3 4
Karsten Hopp 2b3523
--- 34,38 ----
Karsten Hopp 2b3523
  argdo: c d e
Karsten Hopp 2b3523
  windo: 2 3 4
Karsten Hopp 2b3523
  bufdo: 2 3 4 5 6 7 8 9 10 15
Karsten Hopp 2b3523
! bufdo: 4 5 6 7
Karsten Hopp 2b3523
  tabdo: 2 3 4
Karsten Hopp 2b3523
*** ../vim-7.4.645/src/version.c	2015-02-27 19:34:51.464777369 +0100
Karsten Hopp 2b3523
--- src/version.c	2015-02-27 20:04:24.336631611 +0100
Karsten Hopp 2b3523
***************
Karsten Hopp 2b3523
*** 743,744 ****
Karsten Hopp 2b3523
--- 743,746 ----
Karsten Hopp 2b3523
  {   /* Add new patch number below this line */
Karsten Hopp 2b3523
+ /**/
Karsten Hopp 2b3523
+     646,
Karsten Hopp 2b3523
  /**/
Karsten Hopp 2b3523
Karsten Hopp 2b3523
-- 
Karsten Hopp 2b3523
The greatest lies of all time:
Karsten Hopp 2b3523
  (1) The check is in the mail.
Karsten Hopp 2b3523
  (2) We have a really challenging assignment for you.
Karsten Hopp 2b3523
  (3) I love you.
Karsten Hopp 2b3523
  (4) All bugs have been fixed.
Karsten Hopp 2b3523
  (5) This won't hurt a bit.
Karsten Hopp 2b3523
  (6) Honey, I just need to debug this program and be home in 5 minutes.
Karsten Hopp 2b3523
  (7) I have just sent you an e-mail about that.
Karsten Hopp 2b3523
  (8) Of course I'll respect you in the morning.
Karsten Hopp 2b3523
  (9) I'm from the government, and I'm here to help you.
Karsten Hopp 2b3523
Karsten Hopp 2b3523
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 2b3523
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 2b3523
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 2b3523
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///