> Do you mean the first buffer that is listed, thus skipping unlisted
> buffers?
Yes.
Before patch 566 if I had two buffers (1 and 2) and I did
:1bd
:bufdo some_cmd
some_cmd would be executed only on buffer 2.
After 566 some_cmd is executed on buffers 1 and 2. The patch restores the
original behavior.
> Would the fix also work if we didn't split out ex_bufdo()? Or is
> splitting it off essential for being able to fix it?
It can be fixed with or without splitting out ex_bufdo.
I split out the code in ex_bufdo mostly to make it easier for me to understand.
(The original ex_listdo function also handles specifics for :windo, :tabdo and
:argdo.)
Attached is a patch which doesn't involve splitting out the code to handle
bufdo into a separate function.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -r b64f0df9399c src/ex_cmds2.c
--- a/src/ex_cmds2.c Tue Feb 17 17:50:26 2015 +0100
+++ b/src/ex_cmds2.c Thu Feb 19 09:57:48 2015 +1100
@@ -2493,15 +2493,18 @@
case CMD_argdo:
i = eap->line1 - 1;
break;
- case CMD_bufdo:
- i = eap->line1;
- break;
default:
break;
}
/* set pcmark now */
if (eap->cmdidx == CMD_bufdo)
- goto_buffer(eap, DOBUF_FIRST, FORWARD, i);
+ {
+ for (buf = firstbuf; buf && (buf->b_fnum < eap->line1 || !buf->b_p_bl); buf = buf->b_next)
+ ;
+ if (buf == NULL || buf->b_fnum > eap->line2)
+ goto end;
+ goto_buffer(eap, DOBUF_FIRST, FORWARD, buf->b_fnum);
+ }
else
setpcmark();
listcmd_busy = TRUE; /* avoids setting pcmark below */
@@ -2613,6 +2616,7 @@
listcmd_busy = FALSE;
}
+end:
#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
if (save_ei != NULL)
{
diff -r b64f0df9399c src/testdir/test_command_count.in
--- a/src/testdir/test_command_count.in Tue Feb 17 17:50:26 2015 +0100
+++ b/src/testdir/test_command_count.in Thu Feb 19 09:57:48 2015 +1100
@@ -141,6 +141,7 @@
:let buffers = ''
:.,$-bufdo let buffers .= ' '.bufnr('%')
:call add(g:lines, 'bufdo:' . buffers)
+:3bd
:let buffers = ''
:3,7bufdo let buffers .= ' '.bufnr('%')
:call add(g:lines, 'bufdo:' . buffers)
diff -r b64f0df9399c src/testdir/test_command_count.ok
--- a/src/testdir/test_command_count.ok Tue Feb 17 17:50:26 2015 +0100
+++ b/src/testdir/test_command_count.ok Thu Feb 19 09:57:48 2015 +1100
@@ -34,5 +34,5 @@
argdo: c d e
windo: 2 3 4
bufdo: 2 3 4 5 6 7 8 9 10 15
-bufdo: 3 4 5 6 7
+bufdo: 4 5 6 7
tabdo: 2 3 4