On 18:06 Thu 27 Nov , Bram Moolenaar wrote: > > Ken Takata wrote: > > > 2014/11/28 Fri 0:23:27 UTC+9 Bram Moolenaar wrote: > > > Patch 7.4.530 > > > Problem: Many commands take a count or range that is not using line > > > numbers. > > > Solution: For each command specify what kind of count it uses. For > > > windows, > > > buffers and arguments have "$" and "." have a relevant meaning. > > > (Marcin Szamotulski) > > > Files: runtime/doc/editing.txt, runtime/doc/tabpage.txt, > > > runtime/doc/windows.txt, src/Makefile, src/ex_cmds.h, > > > src/ex_docmd.c, src/testdir/Make_amiga.mak > > > src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, > > > src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, > > > src/testdir/Makefile, src/testdir/test_argument_count.in, > > > src/testdir/test_argument_count.ok, > > > src/testdir/test_close_count.in, src/testdir/test_close_count.ok, > > > src/window.c > > > > After this patch, tiny build fails: > > https://travis-ci.org/vim-jp/vim-ci/jobs/42317489#L568 > > I'll make a fix. > > I also notice that when the window number is out of range it just uses > the last window. Now that we have "$" it could be better to give an > error (if backwards compatible). > > > And test on Windows fails: > > https://ci.appveyor.com/project/k-takata/vim-ci/build/108#L1156 > > > NMAKE : fatal error U1073: don't know how to make > > > 'test_argument_count.out' > > Are the test files missing in the repository? > > Yeah, forgot to add them. Done now. > > -- > I am always surprised in the Linux world how quickly solutions can be > obtained. (Imagine sending an email to Bill Gates, asking why Windows > crashed, and how to fix it... and then getting an answer that fixed the > problem... <0>_<0> !) -- Mark Langdon > > /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ > \\\ an exciting new programming language -- http://www.Zimbu.org /// > \\\ help me help AIDS victims -- http://ICCF-Holland.org /// > > -- > -- > 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 vim_dev+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.
I found that `:.,$-bdelete` will trigger a segfault. The attached patch fixes that, and in addition it makes `:%bdelete` and `:%bwipeout` work as well. Best regards, Marcin Szamotulski -- -- 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index d116c9f..30e62d9 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1029,7 +1029,11 @@ list of buffers. |unlisted-buffer| Actually, the buffer isn't completely deleted, it is removed from the buffer list |unlisted-buffer| and option values, variables and mappings/abbreviations for the buffer are - cleared. + cleared. Examples: > + :.,$-bdelete " delete buffers from the current one to + " penulimum one + :%bdelete " delete all buffers +< :bdelete[!] {bufname} *E93* *E94* Like ":bdelete[!] [N]", but buffer given by name. Note that a @@ -1053,7 +1057,11 @@ list of buffers. |unlisted-buffer| Like |:bdelete|, but really delete the buffer. Everything related to the buffer is lost. All marks in this buffer become invalid, option settings are lost, etc. Don't use this - unless you know what you are doing. + unless you know what you are doing. Examples: > + :.+,$bwipeout " wipe out all buffers after the current + " one + :%bwipeout " wipe out all buffers +< :[N]bun[load][!] *:bun* *:bunload* *E515* :bun[load][!] [N] diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 4ce9e92..852ca16 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -1701,14 +1701,14 @@ compute_buffer_local_count(addr_type, lnum, offset) buf = buf->b_next; while (count != 0) { - count += (count < 0) ? 1 : -1; + count += (offset < 0) ? 1 : -1; if (buf->b_prev == NULL) break; - buf = (count < 0) ? buf->b_prev : buf->b_next; + buf = (offset < 0) ? buf->b_prev : buf->b_next; if (addr_type == ADDR_LOADED_BUFFERS) /* skip over unloaded buffers */ while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL) - buf = (count < 0) ? buf->b_prev : buf->b_next; + buf = (offset < 0) ? buf->b_prev : buf->b_next; } return buf->b_fnum; } @@ -2153,6 +2153,7 @@ do_one_cmd(cmdlinep, sourcing, { if (*ea.cmd == '%') /* '%' - all lines */ { + buf_T *buf; ++ea.cmd; switch (ea.addr_type) { @@ -2160,9 +2161,21 @@ do_one_cmd(cmdlinep, sourcing, ea.line1 = 1; ea.line2 = curbuf->b_ml.ml_line_count; break; - case ADDR_WINDOWS: case ADDR_LOADED_BUFFERS: + buf = firstbuf; + while (buf->b_next != NULL && buf->b_ml.ml_mfp == NULL) + buf = buf->b_next; + ea.line1 = buf->b_fnum; + buf = lastbuf; + while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL) + buf = buf->b_prev; + ea.line2 = buf->b_fnum; + break; case ADDR_UNLOADED_BUFFERS: + ea.line1 = firstbuf->b_fnum; + ea.line2 = lastbuf->b_fnum; + break; + case ADDR_WINDOWS: case ADDR_TABS: errormsg = (char_u *)_(e_invrange); goto doend; @@ -4463,7 +4476,7 @@ get_address(ptr, addr_type, skip, to_other_file) n = getdigits(&cmd); if (addr_type == ADDR_LOADED_BUFFERS || addr_type == ADDR_UNLOADED_BUFFERS) - lnum = compute_buffer_local_count(addr_type, lnum, n); + lnum = compute_buffer_local_count(addr_type, lnum, (i == '-') ? -1 * n : n); else if (i == '-') lnum -= n; else
signature.asc
Description: Digital signature