To: vim-dev@vim.org Subject: Patch 6.1.113 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.113 Problem: ":bufdo bwipe" only wipes out half the buffers. (Roman Neuhauser) Solution: Decide what buffer to go to next before executing the command. Files: src/ex_cmds2.c *** ../vim61.112/src/ex_cmds2.c Mon Jun 24 22:49:34 2002 --- src/ex_cmds2.c Thu Jun 27 20:57:51 2002 *************** *** 1397,1402 **** --- 1397,1403 ---- win_T *win; #endif buf_T *buf; + int next_fnum = 0; #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) char_u *save_ei = vim_strsave(p_ei); char_u *new_ei; *************** *** 1458,1463 **** --- 1459,1476 ---- win = win->w_next; } #endif + else if (eap->cmdidx == CMD_bufdo) + { + /* Remember the number of the next listed buffer, in case + * ":bwipe" is used or autocommands do something strange. */ + next_fnum = -1; + for (buf = curbuf->b_next; buf != NULL; buf = buf->b_next) + if (buf->b_p_bl) + { + next_fnum = buf->b_fnum; + break; + } + } /* execute the command */ do_cmdline(eap->arg, eap->getline, eap->cookie, *************** *** 1465,1479 **** if (eap->cmdidx == CMD_bufdo) { ! /* Go to the next listed buffer. Check that we really get ! * there (no autocommands confused us). */ ! for (buf = curbuf->b_next; buf != NULL; buf = buf->b_next) ! if (buf->b_p_bl) break; if (buf == NULL) break; ! goto_buffer(eap, DOBUF_CURRENT, FORWARD, 1); ! if (curbuf != buf) break; } --- 1478,1495 ---- if (eap->cmdidx == CMD_bufdo) { ! /* Done? */ ! if (next_fnum < 0) ! break; ! /* Check if the buffer still exists. */ ! for (buf = firstbuf; buf != NULL; buf = buf->b_next) ! if (buf->b_fnum == next_fnum) break; if (buf == NULL) break; ! goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum); ! /* If autocommands took us elsewhere, quit here */ ! if (curbuf->b_fnum != next_fnum) break; } *** ../vim61.112/src/version.c Mon Jun 24 22:49:34 2002 --- src/version.c Thu Jun 27 21:20:41 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 113, /**/ -- ARTHUR: Well, I AM king... DENNIS: Oh king, eh, very nice. An' how'd you get that, eh? By exploitin' the workers -- by 'angin' on to outdated imperialist dogma which perpetuates the economic an' social differences in our society! If there's ever going to be any progress-- The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///