mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 04:28:33 +00:00
vim-patch:7.4.566
Problem: :argdo, :bufdo, :windo and :tabdo don't take a range. Solution: Support the range. (Marcin Szamotulski) https://code.google.com/p/vim/source/detail?r=v7-4-566
This commit is contained in:
@@ -1844,13 +1844,33 @@ void ex_listdo(exarg_T *eap)
|
||||
|| !check_changed(curbuf, CCGD_AW
|
||||
| (eap->forceit ? CCGD_FORCEIT : 0)
|
||||
| CCGD_EXCMD)) {
|
||||
/* start at the first argument/window/buffer */
|
||||
i = 0;
|
||||
/* start at the eap->line1 argument/window/buffer */
|
||||
wp = firstwin;
|
||||
tp = first_tabpage;
|
||||
switch (eap->cmdidx) {
|
||||
case CMD_windo:
|
||||
for (; wp != NULL && i + 1 < eap->line1; wp = wp->w_next) {
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
case CMD_tabdo:
|
||||
for (; tp != NULL && i + 1 < eap->line1; tp = tp->tp_next) {
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
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, 0);
|
||||
goto_buffer(eap, DOBUF_FIRST, FORWARD, i);
|
||||
else
|
||||
setpcmark();
|
||||
listcmd_busy = TRUE; /* avoids setting pcmark below */
|
||||
@@ -1873,7 +1893,6 @@ void ex_listdo(exarg_T *eap)
|
||||
}
|
||||
if (curwin->w_arg_idx != i)
|
||||
break;
|
||||
++i;
|
||||
} else if (eap->cmdidx == CMD_windo) {
|
||||
/* go to window "wp" */
|
||||
if (!win_valid(wp))
|
||||
@@ -1899,13 +1918,14 @@ void ex_listdo(exarg_T *eap)
|
||||
}
|
||||
}
|
||||
|
||||
++i;
|
||||
/* execute the command */
|
||||
do_cmdline(eap->arg, eap->getline, eap->cookie,
|
||||
DOCMD_VERBOSE + DOCMD_NOWAIT);
|
||||
|
||||
if (eap->cmdidx == CMD_bufdo) {
|
||||
/* Done? */
|
||||
if (next_fnum < 0)
|
||||
if (next_fnum < 0 || next_fnum > eap->line2)
|
||||
break;
|
||||
|
||||
/* Check if the buffer still exists. */
|
||||
@@ -1939,6 +1959,14 @@ void ex_listdo(exarg_T *eap)
|
||||
if (curwin->w_p_scb)
|
||||
do_check_scrollbind(TRUE);
|
||||
}
|
||||
if (eap->cmdidx == CMD_windo || eap->cmdidx == CMD_tabdo) {
|
||||
if (i + 1 > eap->line2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (eap->cmdidx == CMD_argdo && i >= eap->line2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
listcmd_busy = FALSE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user