Blame SOURCES/7.4.535

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