3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.535
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.535 (after 7.4.530)
3ef2ca
Problem:    Can't build with tiny features.
3ef2ca
Solution:   Add #ifdefs and skip a test.
3ef2ca
Files:	    src/ex_docmd.c, src/testdir/test_argument_count.in
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.534/src/ex_docmd.c	2014-11-27 16:38:07.648261279 +0100
3ef2ca
--- src/ex_docmd.c	2014-11-27 18:12:30.874072643 +0100
3ef2ca
***************
3ef2ca
*** 1713,1718 ****
3ef2ca
--- 1713,1765 ----
3ef2ca
      return buf->b_fnum;
3ef2ca
  }
3ef2ca
  
3ef2ca
+ #ifdef FEAT_WINDOWS
3ef2ca
+ static int current_win_nr __ARGS((win_T *win));
3ef2ca
+ static int current_tab_nr __ARGS((tabpage_T *tab));
3ef2ca
+ 
3ef2ca
+     static int
3ef2ca
+ current_win_nr(win)
3ef2ca
+     win_T	*win;
3ef2ca
+ {
3ef2ca
+     win_T	*wp;
3ef2ca
+     int		nr = 0;
3ef2ca
+ 
3ef2ca
+     for (wp = firstwin; wp != NULL; wp = wp->w_next)
3ef2ca
+     {
3ef2ca
+ 	++nr;
3ef2ca
+ 	if (wp == win)
3ef2ca
+ 	    break;
3ef2ca
+     }
3ef2ca
+     return nr;
3ef2ca
+ }
3ef2ca
+ 
3ef2ca
+     static int
3ef2ca
+ current_tab_nr(tab)
3ef2ca
+     tabpage_T   *tab;
3ef2ca
+ {
3ef2ca
+     tabpage_T	*tp;
3ef2ca
+     int		nr = 0;
3ef2ca
+ 
3ef2ca
+     for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
3ef2ca
+     {
3ef2ca
+ 	++nr;
3ef2ca
+ 	if (tp == tab)
3ef2ca
+ 	    break;
3ef2ca
+     }
3ef2ca
+     return nr;
3ef2ca
+ }
3ef2ca
+ 
3ef2ca
+ # define CURRENT_WIN_NR current_win_nr(curwin)
3ef2ca
+ # define LAST_WIN_NR current_win_nr(NULL)
3ef2ca
+ # define CURRENT_TAB_NR current_tab_nr(curtab)
3ef2ca
+ # define LAST_TAB_NR current_tab_nr(NULL)
3ef2ca
+ #else
3ef2ca
+ # define CURRENT_WIN_NR 1
3ef2ca
+ # define LAST_WIN_NR 1
3ef2ca
+ # define CURRENT_TAB_NR 1
3ef2ca
+ # define LAST_TAB_NR 1
3ef2ca
+ #endif
3ef2ca
+ 
3ef2ca
  
3ef2ca
  /*
3ef2ca
   * Execute one Ex command.
3ef2ca
***************
3ef2ca
*** 1765,1772 ****
3ef2ca
  #endif
3ef2ca
      cmdmod_T		save_cmdmod;
3ef2ca
      int			ni;			/* set when Not Implemented */
3ef2ca
-     win_T		*wp;
3ef2ca
-     tabpage_T		*tp;
3ef2ca
      char_u		*cmd;
3ef2ca
  
3ef2ca
      vim_memset(&ea, 0, sizeof(ea));
3ef2ca
--- 1812,1817 ----
3ef2ca
***************
3ef2ca
*** 2085,2097 ****
3ef2ca
  		ea.line2 = curwin->w_cursor.lnum;
3ef2ca
  		break;
3ef2ca
  	    case ADDR_WINDOWS:
3ef2ca
! 		lnum = 0;
3ef2ca
! 		for (wp = firstwin; wp != NULL; wp = wp->w_next)
3ef2ca
! 		{
3ef2ca
! 		    lnum++;
3ef2ca
! 		    if (wp == curwin)
3ef2ca
! 			break;
3ef2ca
! 		}
3ef2ca
  		ea.line2 = lnum;
3ef2ca
  		break;
3ef2ca
  	    case ADDR_ARGUMENTS:
3ef2ca
--- 2130,2136 ----
3ef2ca
  		ea.line2 = curwin->w_cursor.lnum;
3ef2ca
  		break;
3ef2ca
  	    case ADDR_WINDOWS:
3ef2ca
! 		lnum = CURRENT_WIN_NR;
3ef2ca
  		ea.line2 = lnum;
3ef2ca
  		break;
3ef2ca
  	    case ADDR_ARGUMENTS:
3ef2ca
***************
3ef2ca
*** 2102,2114 ****
3ef2ca
  		ea.line2 = curbuf->b_fnum;
3ef2ca
  		break;
3ef2ca
  	    case ADDR_TABS:
3ef2ca
! 		lnum = 0;
3ef2ca
! 		for(tp = first_tabpage; tp != NULL; tp = tp->tp_next)
3ef2ca
! 		{
3ef2ca
! 		    lnum++;
3ef2ca
! 		    if (tp == curtab)
3ef2ca
! 			break;
3ef2ca
! 		}
3ef2ca
  		ea.line2 = lnum;
3ef2ca
  		break;
3ef2ca
  	}
3ef2ca
--- 2141,2147 ----
3ef2ca
  		ea.line2 = curbuf->b_fnum;
3ef2ca
  		break;
3ef2ca
  	    case ADDR_TABS:
3ef2ca
! 		lnum = CURRENT_TAB_NR;
3ef2ca
  		ea.line2 = lnum;
3ef2ca
  		break;
3ef2ca
  	}
3ef2ca
***************
3ef2ca
*** 4198,4205 ****
3ef2ca
      pos_T	pos;
3ef2ca
      pos_T	*fp;
3ef2ca
      linenr_T	lnum;
3ef2ca
-     win_T	*wp;
3ef2ca
-     tabpage_T	*tp;
3ef2ca
  
3ef2ca
      cmd = skipwhite(*ptr);
3ef2ca
      lnum = MAXLNUM;
3ef2ca
--- 4231,4236 ----
3ef2ca
***************
3ef2ca
*** 4215,4227 ****
3ef2ca
  			lnum = curwin->w_cursor.lnum;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_WINDOWS:
3ef2ca
! 			lnum = 0;
3ef2ca
! 			for (wp = firstwin; wp != NULL; wp = wp->w_next)
3ef2ca
! 			{
3ef2ca
! 			    lnum++;
3ef2ca
! 			    if (wp == curwin)
3ef2ca
! 				break;
3ef2ca
! 			}
3ef2ca
  			break;
3ef2ca
  		    case ADDR_ARGUMENTS:
3ef2ca
  			lnum = curwin->w_arg_idx + 1;
3ef2ca
--- 4246,4252 ----
3ef2ca
  			lnum = curwin->w_cursor.lnum;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_WINDOWS:
3ef2ca
! 			lnum = CURRENT_WIN_NR;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_ARGUMENTS:
3ef2ca
  			lnum = curwin->w_arg_idx + 1;
3ef2ca
***************
3ef2ca
*** 4231,4243 ****
3ef2ca
  			lnum = curbuf->b_fnum;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_TABS:
3ef2ca
! 			lnum = 0;
3ef2ca
! 			for(tp = first_tabpage; tp != NULL; tp = tp->tp_next)
3ef2ca
! 			{
3ef2ca
! 			    lnum++;
3ef2ca
! 			    if (tp == curtab)
3ef2ca
! 				break;
3ef2ca
! 			}
3ef2ca
  			break;
3ef2ca
  		}
3ef2ca
  		break;
3ef2ca
--- 4256,4262 ----
3ef2ca
  			lnum = curbuf->b_fnum;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_TABS:
3ef2ca
! 			lnum = CURRENT_TAB_NR;
3ef2ca
  			break;
3ef2ca
  		}
3ef2ca
  		break;
3ef2ca
***************
3ef2ca
*** 4250,4258 ****
3ef2ca
  			lnum = curbuf->b_ml.ml_line_count;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_WINDOWS:
3ef2ca
! 			lnum = 0;
3ef2ca
! 			for (wp = firstwin; wp != NULL; wp = wp->w_next)
3ef2ca
! 			    lnum++;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_ARGUMENTS:
3ef2ca
  			lnum = ARGCOUNT;
3ef2ca
--- 4269,4275 ----
3ef2ca
  			lnum = curbuf->b_ml.ml_line_count;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_WINDOWS:
3ef2ca
! 			lnum = LAST_WIN_NR;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_ARGUMENTS:
3ef2ca
  			lnum = ARGCOUNT;
3ef2ca
***************
3ef2ca
*** 4262,4270 ****
3ef2ca
  			lnum = lastbuf->b_fnum;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_TABS:
3ef2ca
! 			lnum = 0;
3ef2ca
! 			for(tp = first_tabpage; tp != NULL; tp = tp->tp_next)
3ef2ca
! 			    lnum++;
3ef2ca
  			break;
3ef2ca
  		}
3ef2ca
  		break;
3ef2ca
--- 4279,4285 ----
3ef2ca
  			lnum = lastbuf->b_fnum;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_TABS:
3ef2ca
! 			lnum = LAST_TAB_NR;
3ef2ca
  			break;
3ef2ca
  		}
3ef2ca
  		break;
3ef2ca
***************
3ef2ca
*** 4419,4434 ****
3ef2ca
  		switch (addr_type)
3ef2ca
  		{
3ef2ca
  		    case ADDR_LINES:
3ef2ca
! 			lnum = curwin->w_cursor.lnum;	/* "+1" is same as ".+1" */
3ef2ca
  			break;
3ef2ca
  		    case ADDR_WINDOWS:
3ef2ca
! 			lnum = 0;
3ef2ca
! 			for (wp = firstwin; wp != NULL; wp = wp->w_next)
3ef2ca
! 			{
3ef2ca
! 			    lnum++;
3ef2ca
! 			    if (wp == curwin)
3ef2ca
! 				break;
3ef2ca
! 			}
3ef2ca
  			break;
3ef2ca
  		    case ADDR_ARGUMENTS:
3ef2ca
  			lnum = curwin->w_arg_idx + 1;
3ef2ca
--- 4434,4444 ----
3ef2ca
  		switch (addr_type)
3ef2ca
  		{
3ef2ca
  		    case ADDR_LINES:
3ef2ca
! 			/* "+1" is same as ".+1" */
3ef2ca
! 			lnum = curwin->w_cursor.lnum;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_WINDOWS:
3ef2ca
! 			lnum = CURRENT_WIN_NR;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_ARGUMENTS:
3ef2ca
  			lnum = curwin->w_arg_idx + 1;
3ef2ca
***************
3ef2ca
*** 4438,4450 ****
3ef2ca
  			lnum = curbuf->b_fnum;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_TABS:
3ef2ca
! 			lnum = 0;
3ef2ca
! 			for(tp = first_tabpage; tp != NULL; tp = tp->tp_next)
3ef2ca
! 			{
3ef2ca
! 			    lnum++;
3ef2ca
! 			    if (tp == curtab)
3ef2ca
! 				break;
3ef2ca
! 			}
3ef2ca
  			break;
3ef2ca
  		}
3ef2ca
  	    }
3ef2ca
--- 4448,4454 ----
3ef2ca
  			lnum = curbuf->b_fnum;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_TABS:
3ef2ca
! 			lnum = CURRENT_TAB_NR;
3ef2ca
  			break;
3ef2ca
  		}
3ef2ca
  	    }
3ef2ca
***************
3ef2ca
*** 4481,4489 ****
3ef2ca
  			lnum = 0;
3ef2ca
  			break;
3ef2ca
  		    }
3ef2ca
! 		    c = 0;
3ef2ca
! 		    for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
3ef2ca
! 			c++;
3ef2ca
  		    if (lnum >= c)
3ef2ca
  			lnum = c;
3ef2ca
  		    break;
3ef2ca
--- 4485,4491 ----
3ef2ca
  			lnum = 0;
3ef2ca
  			break;
3ef2ca
  		    }
3ef2ca
! 		    c = LAST_TAB_NR;
3ef2ca
  		    if (lnum >= c)
3ef2ca
  			lnum = c;
3ef2ca
  		    break;
3ef2ca
***************
3ef2ca
*** 4493,4501 ****
3ef2ca
  			lnum = 0;
3ef2ca
  			break;
3ef2ca
  		    }
3ef2ca
! 		    c = 0;
3ef2ca
! 		    for (wp = firstwin; wp != NULL; wp = wp->w_next)
3ef2ca
! 			c++;
3ef2ca
  		    if (lnum > c)
3ef2ca
  			lnum = c;
3ef2ca
  		    break;
3ef2ca
--- 4495,4501 ----
3ef2ca
  			lnum = 0;
3ef2ca
  			break;
3ef2ca
  		    }
3ef2ca
! 		    c = LAST_WIN_NR;
3ef2ca
  		    if (lnum > c)
3ef2ca
  			lnum = c;
3ef2ca
  		    break;
3ef2ca
***************
3ef2ca
*** 6805,6819 ****
3ef2ca
  }
3ef2ca
  
3ef2ca
  /*
3ef2ca
!  * ":quit": quit current window, quit Vim if closed the last window.
3ef2ca
   */
3ef2ca
      static void
3ef2ca
  ex_quit(eap)
3ef2ca
      exarg_T	*eap;
3ef2ca
  {
3ef2ca
      win_T	*wp;
3ef2ca
!     buf_T	*buf;
3ef2ca
!     int		wnr;
3ef2ca
  
3ef2ca
  #ifdef FEAT_CMDWIN
3ef2ca
      if (cmdwin_type != 0)
3ef2ca
--- 6805,6819 ----
3ef2ca
  }
3ef2ca
  
3ef2ca
  /*
3ef2ca
!  * ":quit": quit current window, quit Vim if the last window is closed.
3ef2ca
   */
3ef2ca
      static void
3ef2ca
  ex_quit(eap)
3ef2ca
      exarg_T	*eap;
3ef2ca
  {
3ef2ca
+ #if defined(FEAT_WINDOWS) || defined(FEAT_AUTOCMD)
3ef2ca
      win_T	*wp;
3ef2ca
! #endif
3ef2ca
  
3ef2ca
  #ifdef FEAT_CMDWIN
3ef2ca
      if (cmdwin_type != 0)
3ef2ca
***************
3ef2ca
*** 6828,6855 ****
3ef2ca
  	text_locked_msg();
3ef2ca
  	return;
3ef2ca
      }
3ef2ca
      if (eap->addr_count > 0)
3ef2ca
      {
3ef2ca
! 	wnr = eap->line2;
3ef2ca
! 	for (wp = firstwin; --wnr > 0; )
3ef2ca
! 	{
3ef2ca
! 	    if (wp->w_next == NULL)
3ef2ca
  		break;
3ef2ca
- 	    else
3ef2ca
- 		wp = wp->w_next;
3ef2ca
- 	}
3ef2ca
- 	buf = wp->w_buffer;
3ef2ca
      }
3ef2ca
      else
3ef2ca
!     {
3ef2ca
  	wp = curwin;
3ef2ca
! 	buf = curbuf;
3ef2ca
!     }
3ef2ca
  #ifdef FEAT_AUTOCMD
3ef2ca
      apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
3ef2ca
      /* Refuse to quit when locked or when the buffer in the last window is
3ef2ca
       * being closed (can only happen in autocommands). */
3ef2ca
!     if (curbuf_locked() || (buf->b_nwindows == 1 && buf->b_closing))
3ef2ca
  	return;
3ef2ca
  #endif
3ef2ca
  
3ef2ca
--- 6828,6854 ----
3ef2ca
  	text_locked_msg();
3ef2ca
  	return;
3ef2ca
      }
3ef2ca
+ #ifdef FEAT_WINDOWS
3ef2ca
      if (eap->addr_count > 0)
3ef2ca
      {
3ef2ca
! 	int	wnr = eap->line2;
3ef2ca
! 
3ef2ca
! 	for (wp = firstwin; wp->w_next != NULL; wp = wp->w_next)
3ef2ca
! 	    if (--wnr <= 0)
3ef2ca
  		break;
3ef2ca
      }
3ef2ca
      else
3ef2ca
! #endif
3ef2ca
! #if defined(FEAT_WINDOWS) || defined(FEAT_AUTOCMD)
3ef2ca
  	wp = curwin;
3ef2ca
! #endif
3ef2ca
! 
3ef2ca
  #ifdef FEAT_AUTOCMD
3ef2ca
      apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
3ef2ca
      /* Refuse to quit when locked or when the buffer in the last window is
3ef2ca
       * being closed (can only happen in autocommands). */
3ef2ca
!     if (curbuf_locked() || (wp->w_buffer->b_nwindows == 1
3ef2ca
! 						  && wp->w_buffer->b_closing))
3ef2ca
  	return;
3ef2ca
  #endif
3ef2ca
  
3ef2ca
***************
3ef2ca
*** 7214,7222 ****
3ef2ca
  ex_hide(eap)
3ef2ca
      exarg_T	*eap;
3ef2ca
  {
3ef2ca
-     win_T	*win;
3ef2ca
-     int		winnr = 0;
3ef2ca
- 
3ef2ca
      if (*eap->arg != NUL && check_nextcmd(eap->arg) == NULL)
3ef2ca
  	eap->errmsg = e_invarg;
3ef2ca
      else
3ef2ca
--- 7213,7218 ----
3ef2ca
***************
3ef2ca
*** 7231,7237 ****
3ef2ca
  # endif
3ef2ca
  	    if (eap->addr_count == 0)
3ef2ca
  		win_close(curwin, FALSE);	/* don't free buffer */
3ef2ca
! 	    else {
3ef2ca
  		for (win = firstwin; win != NULL; win = win->w_next)
3ef2ca
  		{
3ef2ca
  		    winnr++;
3ef2ca
--- 7227,7237 ----
3ef2ca
  # endif
3ef2ca
  	    if (eap->addr_count == 0)
3ef2ca
  		win_close(curwin, FALSE);	/* don't free buffer */
3ef2ca
! 	    else
3ef2ca
! 	    {
3ef2ca
! 		int	winnr = 0;
3ef2ca
! 		win_T	*win;
3ef2ca
! 
3ef2ca
  		for (win = firstwin; win != NULL; win = win->w_next)
3ef2ca
  		{
3ef2ca
  		    winnr++;
3ef2ca
*** ../vim-7.4.534/src/testdir/test_argument_count.in	2014-11-27 16:22:42.746412995 +0100
3ef2ca
--- src/testdir/test_argument_count.in	2014-11-27 18:21:05.568408375 +0100
3ef2ca
***************
3ef2ca
*** 1,6 ****
3ef2ca
--- 1,7 ----
3ef2ca
  Tests for :[count]argument! and :[count]argdelete     vim: set ft=vim :
3ef2ca
  
3ef2ca
  STARTTEST
3ef2ca
+ :so small.vim
3ef2ca
  :%argd
3ef2ca
  :argadd a b c d
3ef2ca
  :set hidden
3ef2ca
*** ../vim-7.4.534/src/version.c	2014-11-27 17:44:05.380820867 +0100
3ef2ca
--- src/version.c	2014-11-27 18:30:32.826167330 +0100
3ef2ca
***************
3ef2ca
*** 743,744 ****
3ef2ca
--- 743,746 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     535,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
Mushrooms always grow in damp places and so they look like umbrellas.
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    ///