Hi Bram and list,
How to reproduce:
- Start Vanilla Vim edit xx
$ vim -Nu NONE xx
- Split verticaly and create window for empty buffer.
:vnew
- Jump to a such window or create new tabpage. Actually, already xx exists, it
jumps to that window.
:tab drop xx
Expected behavior:
- Jumps to xx window. because xx already exists.
Actual behavior:
- Create a new tabpage unexpectedly.
NOTE:
When `:new` is used instead of `:vnew`, it will be the expected behavior.
Investigation result:
do_arg_all()'s 3rd argument `keep_tabs` is false that means for mainly `:all`
command.
And...
[src/buffer.c]
4860 if (buf->b_ffname == NULL
4861 || (!keep_tabs && (buf->b_nwindows > 1
4862 || wp->w_width != Columns)))
Also `wp->w_width != Columns` should for only `!keep_tabs` (:all command).
I wrote a patch contained a test.
Check and include it please.
BTW, the following description(at L4846) does not seem to be written in the
document of `:all`.
[src/buffer.c]
4844 /*
4845 * Try closing all windows that are not in the argument list.
4846 * Also close windows that are not full width;
Add to a document? or remove a code?
--
Best regards,
Hirohito Higashi (a.k.a. h_east)
--
--
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 --git a/src/buffer.c b/src/buffer.c
index e5d2dde..e77fc04 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4858,8 +4858,8 @@ do_arg_all(
wpnext = wp->w_next;
buf = wp->w_buffer;
if (buf->b_ffname == NULL
- || (!keep_tabs && buf->b_nwindows > 1)
- || wp->w_width != Columns)
+ || (!keep_tabs && (buf->b_nwindows > 1
+ || wp->w_width != Columns)))
i = opened_len;
else
{
diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim
index 3f69fb9..1720107 100644
--- a/src/testdir/test_tabpage.vim
+++ b/src/testdir/test_tabpage.vim
@@ -65,6 +65,15 @@ function Test_tabpage()
call assert_true(tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1)
tabclose
q
+ "
+ "
+ " Test for ":tab drop vertical-split-window" to jump test1 buffer
+ tabedit test1
+ vnew
+ tabfirst
+ tab drop test1
+ call assert_equal([2, 2, 2, 2], [tabpagenr('$'), tabpagenr(), tabpagewinnr(2, '$'), tabpagewinnr(2)])
+ 1tabonly
endif
"
"