Blame SOURCES/7.4.566

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.566
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.566
22c937
Problem:    :argdo, :bufdo, :windo and :tabdo don't take a range.
22c937
Solution:   Support the range. (Marcin Szamotulski)
22c937
Files:	    runtime/doc/editing.txt, runtime/doc/tabpage.txt,
22c937
	    runtime/doc/windows.txt, src/ex_cmds.h, src/ex_cmds2.c,
22c937
	    src/testdir/test_command_count.in,
22c937
	    src/testdir/test_command_count.ok
22c937
22c937
22c937
*** ../vim-7.4.565/runtime/doc/editing.txt	2014-11-27 16:22:42.734413130 +0100
22c937
--- runtime/doc/editing.txt	2015-01-07 16:09:20.501100753 +0100
22c937
***************
22c937
*** 38,43 ****
22c937
--- 38,44 ----
22c937
  file name.  It can be used with "#" on the command line |:_#| and you can use
22c937
  the |CTRL-^| command to toggle between the current and the alternate file.
22c937
  However, the alternate file name is not changed when |:keepalt| is used.
22c937
+ An alternate file name is remembered for each window.
22c937
  
22c937
  							*:keepalt* *:keepa*
22c937
  :keepalt {cmd}		Execute {cmd} while keeping the current alternate file
22c937
***************
22c937
*** 610,616 ****
22c937
  :[count]arga[dd] {name} ..			*:arga* *:argadd* *E479*
22c937
  :[count]arga[dd]
22c937
  			Add the {name}s to the argument list.  When {name} is
22c937
! 			omitted at the current buffer name to the argument
22c937
  			list.
22c937
  			If [count] is omitted, the {name}s are added just
22c937
  			after the current entry in the argument list.
22c937
--- 611,617 ----
22c937
  :[count]arga[dd] {name} ..			*:arga* *:argadd* *E479*
22c937
  :[count]arga[dd]
22c937
  			Add the {name}s to the argument list.  When {name} is
22c937
! 			omitted add the current buffer name to the argument
22c937
  			list.
22c937
  			If [count] is omitted, the {name}s are added just
22c937
  			after the current entry in the argument list.
22c937
***************
22c937
*** 831,838 ****
22c937
  USING THE ARGUMENT LIST
22c937
  
22c937
  						*:argdo*
22c937
! :argdo[!] {cmd}		Execute {cmd} for each file in the argument list.
22c937
! 			It works like doing this: >
22c937
  				:rewind
22c937
  				:{cmd}
22c937
  				:next
22c937
--- 832,840 ----
22c937
  USING THE ARGUMENT LIST
22c937
  
22c937
  						*:argdo*
22c937
! :[range]argdo[!] {cmd}	Execute {cmd} for each file in the argument list or
22c937
! 			if [range] is specified only for arguments in that
22c937
! 			range.  It works like doing this: >
22c937
  				:rewind
22c937
  				:{cmd}
22c937
  				:next
22c937
***************
22c937
*** 1090,1096 ****
22c937
  
22c937
  :q[uit]!		Quit without writing, also when currently visible
22c937
  			buffers have changes.  Does not exit when this is the
22c937
! 			last window and there are is a changed hidden buffer.
22c937
  			In this case, the first changed hidden buffer becomes
22c937
  			the current buffer.
22c937
  			Use ":qall!" to exit always.
22c937
--- 1092,1098 ----
22c937
  
22c937
  :q[uit]!		Quit without writing, also when currently visible
22c937
  			buffers have changes.  Does not exit when this is the
22c937
! 			last window and there is a changed hidden buffer.
22c937
  			In this case, the first changed hidden buffer becomes
22c937
  			the current buffer.
22c937
  			Use ":qall!" to exit always.
22c937
***************
22c937
*** 1390,1396 ****
22c937
  You could do this to edit very secret text: >
22c937
  	:set noundofile viminfo=
22c937
  	:noswapfile edit secrets.txt
22c937
! Keep in mind that without a swap file you risk loosing your work in a crash.
22c937
  
22c937
  WARNING: If you make a typo when entering the key and then write the file and
22c937
  exit, the text will be lost!
22c937
--- 1392,1398 ----
22c937
  You could do this to edit very secret text: >
22c937
  	:set noundofile viminfo=
22c937
  	:noswapfile edit secrets.txt
22c937
! Keep in mind that without a swap file you risk losing your work in a crash.
22c937
  
22c937
  WARNING: If you make a typo when entering the key and then write the file and
22c937
  exit, the text will be lost!
22c937
***************
22c937
*** 1426,1438 ****
22c937
  set automatically to the method used when that file was written.  You can
22c937
  change 'cryptmethod' before writing that file to change the method.
22c937
  
22c937
! To set the default method, used for new files, use one of these in your
22c937
! |vimrc| file: >
22c937
! 	set cm=zip
22c937
  	set cm=blowfish2
22c937
! Use the first one if you need to be compatible with Vim 7.2 and older.  Using
22c937
! "blowfish2" is highly recommended if you can use a Vim version that supports
22c937
! it.
22c937
  
22c937
  The message given for reading and writing a file will show "[crypted]" when
22c937
  using zip, "[blowfish]" when using blowfish, etc.
22c937
--- 1428,1438 ----
22c937
  set automatically to the method used when that file was written.  You can
22c937
  change 'cryptmethod' before writing that file to change the method.
22c937
  
22c937
! To set the default method, used for new files, use this in your |vimrc| 
22c937
! file: >
22c937
  	set cm=blowfish2
22c937
! Using "blowfish2" is highly recommended.  Only use another method if you
22c937
! must use an older Vim version that does not support it.
22c937
  
22c937
  The message given for reading and writing a file will show "[crypted]" when
22c937
  using zip, "[blowfish]" when using blowfish, etc.
22c937
***************
22c937
*** 1494,1501 ****
22c937
  - Pkzip uses the same encryption as 'cryptmethod' "zip", and US Govt has no
22c937
    objection to its export.  Pkzip's public file APPNOTE.TXT describes this
22c937
    algorithm in detail.
22c937
! - The implmentation of 'cryptmethod' "blowfish" has a flaw.  It is possible to
22c937
!   crack the first 64 bytes of a file and in some circumstances more of the
22c937
    file. Use of it is not recommended, but it's still the strongest method
22c937
    supported by Vim 7.3 and 7.4.  The "zip" method is even weaker.
22c937
  - Vim originates from the Netherlands.  That is where the sources come from.
22c937
--- 1494,1501 ----
22c937
  - Pkzip uses the same encryption as 'cryptmethod' "zip", and US Govt has no
22c937
    objection to its export.  Pkzip's public file APPNOTE.TXT describes this
22c937
    algorithm in detail.
22c937
! - The implementation of 'cryptmethod' "blowfish" has a flaw.  It is possible
22c937
!   to crack the first 64 bytes of a file and in some circumstances more of the
22c937
    file. Use of it is not recommended, but it's still the strongest method
22c937
    supported by Vim 7.3 and 7.4.  The "zip" method is even weaker.
22c937
  - Vim originates from the Netherlands.  That is where the sources come from.
22c937
*** ../vim-7.4.565/runtime/doc/tabpage.txt	2014-11-27 16:22:42.738413084 +0100
22c937
--- runtime/doc/tabpage.txt	2015-01-07 16:09:20.501100753 +0100
22c937
***************
22c937
*** 206,212 ****
22c937
  		    :tabmove	" move the tab page to the right
22c937
  		    :.tabmove	" as above
22c937
  		    :+tabmove	" as above
22c937
! 		    :0tabmove	" move the tab page to the begining of the tab
22c937
  				" list
22c937
  		    :$tabmove	" move the tab page to the end of the tab list
22c937
  <
22c937
--- 206,212 ----
22c937
  		    :tabmove	" move the tab page to the right
22c937
  		    :.tabmove	" as above
22c937
  		    :+tabmove	" as above
22c937
! 		    :0tabmove	" move the tab page to the beginning of the tab
22c937
  				" list
22c937
  		    :$tabmove	" move the tab page to the end of the tab list
22c937
  <
22c937
***************
22c937
*** 224,231 ****
22c937
  LOOPING OVER TAB PAGES:
22c937
  
22c937
  							*:tabd* *:tabdo*
22c937
! :tabd[o] {cmd}	Execute {cmd} in each tab page.
22c937
! 		It works like doing this: >
22c937
  			:tabfirst
22c937
  			:{cmd}
22c937
  			:tabnext
22c937
--- 224,233 ----
22c937
  LOOPING OVER TAB PAGES:
22c937
  
22c937
  							*:tabd* *:tabdo*
22c937
! :[range]tabd[o] {cmd}
22c937
! 		Execute {cmd} in each tab page or if [range] is given only in
22c937
! 		tab pages which tab page number is in the [range].  It works
22c937
! 		like doing this: >
22c937
  			:tabfirst
22c937
  			:{cmd}
22c937
  			:tabnext
22c937
***************
22c937
*** 271,278 ****
22c937
  triggers:
22c937
  	WinLeave		leave current window
22c937
  	TabLeave		leave current tab page
22c937
- 	TabEnter		enter new tab page
22c937
  	WinEnter		enter window in new tab page
22c937
  	BufLeave		leave current buffer
22c937
  	BufEnter		enter new empty buffer
22c937
  
22c937
--- 273,280 ----
22c937
  triggers:
22c937
  	WinLeave		leave current window
22c937
  	TabLeave		leave current tab page
22c937
  	WinEnter		enter window in new tab page
22c937
+ 	TabEnter		enter new tab page
22c937
  	BufLeave		leave current buffer
22c937
  	BufEnter		enter new empty buffer
22c937
  
22c937
*** ../vim-7.4.565/runtime/doc/windows.txt	2014-11-30 14:50:12.255356230 +0100
22c937
--- runtime/doc/windows.txt	2015-01-07 16:09:20.501100753 +0100
22c937
***************
22c937
*** 278,293 ****
22c937
  		and there is only one window for the current buffer, and the
22c937
  		buffer was changed, the command fails.
22c937
  		
22c937
! 		(Note: CTRL-Q does not
22c937
! 		work on all terminals).  If [count] is greater than
22c937
! 		the last window number the last window will be closed: >
22c937
  		    :1quit  " quit the first window
22c937
  		    :$quit  " quit the last window
22c937
  		    :9quit  " quit the last window
22c937
  			     " if there are less than 9 windows opened
22c937
  		    :-quit  " quit the previews window
22c937
  		    :+quit  " quit the next window
22c937
! 		    :+2quit " will also work as expected
22c937
  <
22c937
  :q[uit]!
22c937
  :{count}q[uit]!
22c937
--- 278,294 ----
22c937
  		and there is only one window for the current buffer, and the
22c937
  		buffer was changed, the command fails.
22c937
  		
22c937
! 		(Note: CTRL-Q does not work on all terminals).
22c937
! 		
22c937
! 		If [count] is greater than the last window number the last
22c937
! 		window will be closed: >
22c937
  		    :1quit  " quit the first window
22c937
  		    :$quit  " quit the last window
22c937
  		    :9quit  " quit the last window
22c937
  			     " if there are less than 9 windows opened
22c937
  		    :-quit  " quit the previews window
22c937
  		    :+quit  " quit the next window
22c937
! 		    :+2quit " quit the second next window
22c937
  <
22c937
  :q[uit]!
22c937
  :{count}q[uit]!
22c937
***************
22c937
*** 332,340 ****
22c937
  		screen.  For {count} see |:quit| command.
22c937
  		
22c937
  		The buffer becomes hidden (unless there is another window
22c937
! 		editing it or 'bufhidden' is "unload" or "delete").  If the
22c937
! 		window is the last one in the current tab page the tab page is
22c937
! 		closed.  |tab-page| 
22c937
  		
22c937
  		The value of 'hidden' is irrelevant for this command.  Changes
22c937
  		to the buffer are not written and won't get lost, so this is a
22c937
--- 333,341 ----
22c937
  		screen.  For {count} see |:quit| command.
22c937
  		
22c937
  		The buffer becomes hidden (unless there is another window
22c937
! 		editing it or 'bufhidden' is "unload", "delete" or "wipe").
22c937
! 		If the window is the last one in the current tab page the tab
22c937
! 		page is closed.  |tab-page| 
22c937
  		
22c937
  		The value of 'hidden' is irrelevant for this command.  Changes
22c937
  		to the buffer are not written and won't get lost, so this is a
22c937
***************
22c937
*** 697,704 ****
22c937
  8. Do a command in all buffers or windows			*list-repeat*
22c937
  
22c937
  							*:windo*
22c937
! :windo {cmd}		Execute {cmd} in each window.
22c937
! 			It works like doing this: >
22c937
  				CTRL-W t
22c937
  				:{cmd}
22c937
  				CTRL-W w
22c937
--- 698,706 ----
22c937
  8. Do a command in all buffers or windows			*list-repeat*
22c937
  
22c937
  							*:windo*
22c937
! :[range]windo {cmd}	Execute {cmd} in each window or if [range] is given
22c937
! 			only in windows for which the window number lies in
22c937
! 			the [range].  It works like doing this: >
22c937
  				CTRL-W t
22c937
  				:{cmd}
22c937
  				CTRL-W w
22c937
***************
22c937
*** 716,723 ****
22c937
  			Also see |:tabdo|, |:argdo| and |:bufdo|.
22c937
  
22c937
  							*:bufdo*
22c937
! :bufdo[!] {cmd}		Execute {cmd} in each buffer in the buffer list.
22c937
! 			It works like doing this: >
22c937
  				:bfirst
22c937
  				:{cmd}
22c937
  				:bnext
22c937
--- 718,727 ----
22c937
  			Also see |:tabdo|, |:argdo| and |:bufdo|.
22c937
  
22c937
  							*:bufdo*
22c937
! :[range]bufdo[!] {cmd}	Execute {cmd} in each buffer in the buffer list or if
22c937
! 			[range] is given only for buffers for which their
22c937
! 			buffer numer is in the [range].  It works like doing
22c937
! 			this: >
22c937
  				:bfirst
22c937
  				:{cmd}
22c937
  				:bnext
22c937
***************
22c937
*** 763,780 ****
22c937
  
22c937
  CTRL-W ]					*CTRL-W_]* *CTRL-W_CTRL-]*
22c937
  CTRL-W CTRL-]	Split current window in two.  Use identifier under cursor as a
22c937
! 		tag and jump to it in the new upper window.  Make new window N
22c937
! 		high.
22c937
  
22c937
  							*CTRL-W_g]*
22c937
  CTRL-W g ]	Split current window in two.  Use identifier under cursor as a
22c937
  		tag and perform ":tselect" on it in the new upper window.
22c937
  		Make new window N high.
22c937
  
22c937
  							*CTRL-W_g_CTRL-]*
22c937
  CTRL-W g CTRL-]	Split current window in two.  Use identifier under cursor as a
22c937
! 		tag and perform ":tjump" on it in the new upper window.  Make
22c937
! 		new window N high.
22c937
  
22c937
  CTRL-W f					*CTRL-W_f* *CTRL-W_CTRL-F*
22c937
  CTRL-W CTRL-F	Split current window in two.  Edit file name under cursor.
22c937
--- 767,787 ----
22c937
  
22c937
  CTRL-W ]					*CTRL-W_]* *CTRL-W_CTRL-]*
22c937
  CTRL-W CTRL-]	Split current window in two.  Use identifier under cursor as a
22c937
! 		tag and jump to it in the new upper window.
22c937
! 		In Visual mode uses the Visually selected text as a tag.
22c937
! 		Make new window N high.
22c937
  
22c937
  							*CTRL-W_g]*
22c937
  CTRL-W g ]	Split current window in two.  Use identifier under cursor as a
22c937
  		tag and perform ":tselect" on it in the new upper window.
22c937
+ 		In Visual mode uses the Visually selected text as a tag.
22c937
  		Make new window N high.
22c937
  
22c937
  							*CTRL-W_g_CTRL-]*
22c937
  CTRL-W g CTRL-]	Split current window in two.  Use identifier under cursor as a
22c937
! 		tag and perform ":tjump" on it in the new upper window.
22c937
! 		In Visual mode uses the Visually selected text as a tag.
22c937
! 		Make new window N high.
22c937
  
22c937
  CTRL-W f					*CTRL-W_f* *CTRL-W_CTRL-F*
22c937
  CTRL-W CTRL-F	Split current window in two.  Edit file name under cursor.
22c937
*** ../vim-7.4.565/src/ex_cmds.h	2015-01-07 15:57:13.145559792 +0100
22c937
--- src/ex_cmds.h	2015-01-07 16:13:24.406265045 +0100
22c937
***************
22c937
*** 133,140 ****
22c937
  			BANG|RANGE|NOTADR|FILES|TRLBAR,
22c937
  			ADDR_ARGUMENTS),
22c937
  EX(CMD_argdo,		"argdo",	ex_listdo,
22c937
! 			BANG|NEEDARG|EXTRA|NOTRLCOM,
22c937
! 			ADDR_LINES),
22c937
  EX(CMD_argedit,		"argedit",	ex_argedit,
22c937
  			BANG|NEEDARG|RANGE|NOTADR|FILE1|EDITCMD|ARGOPT|TRLBAR,
22c937
  			ADDR_ARGUMENTS),
22c937
--- 133,140 ----
22c937
  			BANG|RANGE|NOTADR|FILES|TRLBAR,
22c937
  			ADDR_ARGUMENTS),
22c937
  EX(CMD_argdo,		"argdo",	ex_listdo,
22c937
! 			BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL,
22c937
! 			ADDR_ARGUMENTS),
22c937
  EX(CMD_argedit,		"argedit",	ex_argedit,
22c937
  			BANG|NEEDARG|RANGE|NOTADR|FILE1|EDITCMD|ARGOPT|TRLBAR,
22c937
  			ADDR_ARGUMENTS),
22c937
***************
22c937
*** 220,227 ****
22c937
  			BANG|TRLBAR|CMDWIN,
22c937
  			ADDR_LINES),
22c937
  EX(CMD_bufdo,		"bufdo",	ex_listdo,
22c937
! 			BANG|NEEDARG|EXTRA|NOTRLCOM,
22c937
! 			ADDR_LINES),
22c937
  EX(CMD_bunload,		"bunload",	ex_bunload,
22c937
  			BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR,
22c937
  			ADDR_LOADED_BUFFERS),
22c937
--- 220,227 ----
22c937
  			BANG|TRLBAR|CMDWIN,
22c937
  			ADDR_LINES),
22c937
  EX(CMD_bufdo,		"bufdo",	ex_listdo,
22c937
! 			BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL,
22c937
! 			ADDR_BUFFERS),
22c937
  EX(CMD_bunload,		"bunload",	ex_bunload,
22c937
  			BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR,
22c937
  			ADDR_LOADED_BUFFERS),
22c937
***************
22c937
*** 1384,1391 ****
22c937
  			RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN,
22c937
  			ADDR_TABS),
22c937
  EX(CMD_tabdo,		"tabdo",	ex_listdo,
22c937
! 			NEEDARG|EXTRA|NOTRLCOM,
22c937
! 			ADDR_LINES),
22c937
  EX(CMD_tabedit,		"tabedit",	ex_splitview,
22c937
  			BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR,
22c937
  			ADDR_TABS),
22c937
--- 1384,1391 ----
22c937
  			RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN,
22c937
  			ADDR_TABS),
22c937
  EX(CMD_tabdo,		"tabdo",	ex_listdo,
22c937
! 			NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL,
22c937
! 			ADDR_TABS),
22c937
  EX(CMD_tabedit,		"tabedit",	ex_splitview,
22c937
  			BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR,
22c937
  			ADDR_TABS),
22c937
***************
22c937
*** 1576,1583 ****
22c937
  			NEEDARG|WORD1|RANGE|NOTADR,
22c937
  			ADDR_WINDOWS),
22c937
  EX(CMD_windo,		"windo",	ex_listdo,
22c937
! 			BANG|NEEDARG|EXTRA|NOTRLCOM,
22c937
! 			ADDR_LINES),
22c937
  EX(CMD_winpos,		"winpos",	ex_winpos,
22c937
  			EXTRA|TRLBAR|CMDWIN,
22c937
  			ADDR_LINES),
22c937
--- 1576,1583 ----
22c937
  			NEEDARG|WORD1|RANGE|NOTADR,
22c937
  			ADDR_WINDOWS),
22c937
  EX(CMD_windo,		"windo",	ex_listdo,
22c937
! 			BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL,
22c937
! 			ADDR_WINDOWS),
22c937
  EX(CMD_winpos,		"winpos",	ex_winpos,
22c937
  			EXTRA|TRLBAR|CMDWIN,
22c937
  			ADDR_LINES),
22c937
*** ../vim-7.4.565/src/ex_cmds2.c	2014-11-19 16:38:01.512679964 +0100
22c937
--- src/ex_cmds2.c	2015-01-07 16:12:42.526751920 +0100
22c937
***************
22c937
*** 2472,2486 ****
22c937
  				    | (eap->forceit ? CCGD_FORCEIT : 0)
22c937
  				    | CCGD_EXCMD))
22c937
      {
22c937
- 	/* start at the first argument/window/buffer */
22c937
  	i = 0;
22c937
  #ifdef FEAT_WINDOWS
22c937
  	wp = firstwin;
22c937
  	tp = first_tabpage;
22c937
  #endif
22c937
  	/* set pcmark now */
22c937
  	if (eap->cmdidx == CMD_bufdo)
22c937
! 	    goto_buffer(eap, DOBUF_FIRST, FORWARD, 0);
22c937
  	else
22c937
  	    setpcmark();
22c937
  	listcmd_busy = TRUE;	    /* avoids setting pcmark below */
22c937
--- 2472,2507 ----
22c937
  				    | (eap->forceit ? CCGD_FORCEIT : 0)
22c937
  				    | CCGD_EXCMD))
22c937
      {
22c937
  	i = 0;
22c937
+ 	/* start at the eap->line1 argument/window/buffer */
22c937
  #ifdef FEAT_WINDOWS
22c937
  	wp = firstwin;
22c937
  	tp = first_tabpage;
22c937
  #endif
22c937
+ 	switch (eap->cmdidx)
22c937
+ 	{
22c937
+ #ifdef FEAT_WINDOWS
22c937
+ 	    case CMD_windo:
22c937
+ 		for ( ; wp != NULL && i + 1 < eap->line1; wp = wp->w_next)
22c937
+ 		    i++;
22c937
+ 		break;
22c937
+ 	    case CMD_tabdo:
22c937
+ 		for( ; tp != NULL && i + 1 < eap->line1; tp = tp->tp_next)
22c937
+ 		    i++;
22c937
+ 		break;
22c937
+ #endif
22c937
+ 	    case CMD_argdo:
22c937
+ 		i = eap->line1 - 1;
22c937
+ 		break;
22c937
+ 	    case CMD_bufdo:
22c937
+ 		i = eap->line1;
22c937
+ 		break;
22c937
+ 	    default:
22c937
+ 		break;
22c937
+ 	}
22c937
  	/* set pcmark now */
22c937
  	if (eap->cmdidx == CMD_bufdo)
22c937
! 	    goto_buffer(eap, DOBUF_FIRST, FORWARD, i);
22c937
  	else
22c937
  	    setpcmark();
22c937
  	listcmd_busy = TRUE;	    /* avoids setting pcmark below */
22c937
***************
22c937
*** 2506,2512 ****
22c937
  		}
22c937
  		if (curwin->w_arg_idx != i)
22c937
  		    break;
22c937
- 		++i;
22c937
  	    }
22c937
  #ifdef FEAT_WINDOWS
22c937
  	    else if (eap->cmdidx == CMD_windo)
22c937
--- 2527,2532 ----
22c937
***************
22c937
*** 2541,2546 ****
22c937
--- 2561,2568 ----
22c937
  		    }
22c937
  	    }
22c937
  
22c937
+ 	    ++i;
22c937
+ 
22c937
  	    /* execute the command */
22c937
  	    do_cmdline(eap->arg, eap->getline, eap->cookie,
22c937
  						DOCMD_VERBOSE + DOCMD_NOWAIT);
22c937
***************
22c937
*** 2548,2554 ****
22c937
  	    if (eap->cmdidx == CMD_bufdo)
22c937
  	    {
22c937
  		/* Done? */
22c937
! 		if (next_fnum < 0)
22c937
  		    break;
22c937
  		/* Check if the buffer still exists. */
22c937
  		for (buf = firstbuf; buf != NULL; buf = buf->b_next)
22c937
--- 2570,2576 ----
22c937
  	    if (eap->cmdidx == CMD_bufdo)
22c937
  	    {
22c937
  		/* Done? */
22c937
! 		if (next_fnum < 0 || next_fnum > eap->line2)
22c937
  		    break;
22c937
  		/* Check if the buffer still exists. */
22c937
  		for (buf = firstbuf; buf != NULL; buf = buf->b_next)
22c937
***************
22c937
*** 2579,2584 ****
22c937
--- 2601,2614 ----
22c937
  		    do_check_scrollbind(TRUE);
22c937
  #endif
22c937
  	    }
22c937
+ 
22c937
+ #ifdef FEAT_WINDOWS
22c937
+ 	    if (eap->cmdidx == CMD_windo || eap->cmdidx == CMD_tabdo)
22c937
+ 		if (i+1 > eap->line2)
22c937
+ 		    break;
22c937
+ #endif
22c937
+ 	    if (eap->cmdidx == CMD_argdo && i >= eap->line2)
22c937
+ 		break;
22c937
  	}
22c937
  	listcmd_busy = FALSE;
22c937
      }
22c937
*** ../vim-7.4.565/src/testdir/test_command_count.in	2015-01-07 15:57:13.145559792 +0100
22c937
--- src/testdir/test_command_count.in	2015-01-07 16:19:57.217698877 +0100
22c937
***************
22c937
*** 90,95 ****
22c937
--- 90,129 ----
22c937
  :only!
22c937
  :e! test.out
22c937
  :call append(0, g:lines)
22c937
+ :unlet g:lines
22c937
+ :w|bd
22c937
+ :se hidden
22c937
+ :b1
22c937
+ ENDTEST
22c937
+ 
22c937
+ STARTTEST
22c937
+ :only!
22c937
+ :let g:lines = []
22c937
+ :%argd
22c937
+ :arga a b c d e f
22c937
+ :3argu
22c937
+ :let args = ''
22c937
+ :.,$-argdo let args .= ' '.expand('%')
22c937
+ :call add(g:lines, 'argdo:' . args)
22c937
+ :split|split|split|split
22c937
+ :2wincmd w
22c937
+ :let windows = ''
22c937
+ :.,$-windo let windows .= ' '.winnr()
22c937
+ :call add(g:lines, 'windo:'. windows)
22c937
+ :b2
22c937
+ :let buffers = ''
22c937
+ :.,$-bufdo let buffers .= ' '.bufnr('%')
22c937
+ :call add(g:lines, 'bufdo:' . buffers)
22c937
+ :let buffers = ''
22c937
+ :3,7bufdo let buffers .= ' '.bufnr('%')
22c937
+ :call add(g:lines, 'bufdo:' . buffers)
22c937
+ :tabe|tabe|tabe|tabe
22c937
+ :normal! 2gt
22c937
+ :let tabpages = ''
22c937
+ :.,$-tabdo let tabpages .= ' '.tabpagenr()
22c937
+ :call add(g:lines, 'tabdo:' . tabpages)
22c937
+ :e! test.out
22c937
+ :call append('$', g:lines)
22c937
  :w|qa!
22c937
  ENDTEST
22c937
  
22c937
*** ../vim-7.4.565/src/testdir/test_command_count.ok	2015-01-07 15:57:13.145559792 +0100
22c937
--- src/testdir/test_command_count.ok	2015-01-07 16:19:51.805761782 +0100
22c937
***************
22c937
*** 28,30 ****
22c937
--- 28,35 ----
22c937
  $+tabe E16: Invalid range
22c937
  0tabm x
22c937
  
22c937
+ argdo: c d e
22c937
+ windo: 2 3 4
22c937
+ bufdo: 2 3 4 5 6 7 8 9 10 12
22c937
+ bufdo: 3 4 5 6 7
22c937
+ tabdo: 2 3 4
22c937
*** ../vim-7.4.565/src/version.c	2015-01-07 15:57:13.149559746 +0100
22c937
--- src/version.c	2015-01-07 16:50:24.620511525 +0100
22c937
***************
22c937
*** 743,744 ****
22c937
--- 743,746 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     566,
22c937
  /**/
22c937
22c937
-- 
22c937
ERROR 047: Keyboard not found.  Press RETURN to continue.
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    ///