diff options
Diffstat (limited to 'src/nvim/ex_cmds2.c')
| -rw-r--r-- | src/nvim/ex_cmds2.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index e7029b8762..efa18aa681 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1862,20 +1862,30 @@ void ex_listdo(exarg_T *eap) case CMD_argdo: i = eap->line1 - 1; break; - case CMD_bufdo: - i = eap->line1; - break; default: break; } + buf_T *buf = curbuf; /* set pcmark now */ - if (eap->cmdidx == CMD_bufdo) - goto_buffer(eap, DOBUF_FIRST, FORWARD, i); - else + if (eap->cmdidx == CMD_bufdo) { + /* Advance to the first listed buffer after "eap->line1". */ + for (buf = firstbuf; + buf != NULL && (buf->b_fnum < eap->line1 || !buf->b_p_bl); + buf = buf->b_next) { + if (buf->b_fnum > eap->line2) { + buf = NULL; + break; + } + } + if (buf != NULL) { + goto_buffer(eap, DOBUF_FIRST, FORWARD, buf->b_fnum); + } + } else { setpcmark(); + } listcmd_busy = TRUE; /* avoids setting pcmark below */ - while (!got_int) { + while (!got_int && buf != NULL) { if (eap->cmdidx == CMD_argdo) { /* go to argument "i" */ if (i == ARGCOUNT) @@ -2614,7 +2624,7 @@ char_u *get_scriptname(scid_T id) } # if defined(EXITFREE) -void free_scriptnames() +void free_scriptnames(void) { # define FREE_SCRIPTNAME(item) xfree((item)->sn_name) GA_DEEP_CLEAR(&script_items, scriptitem_T, FREE_SCRIPTNAME); @@ -2992,12 +3002,8 @@ void ex_checktime(exarg_T *eap) static char *get_locale_val(int what) { - char *loc; - - /* Obtain the locale value from the libraries. For DJGPP this is - * redefined and it doesn't use the arguments. */ - loc = setlocale(what, NULL); - + // Obtain the locale value from the libraries. + char *loc = setlocale(what, NULL); return loc; } |