Commit: patch 9.2.0397: tabpanel: double-click opens a new tab

5 views
Skip to first unread message

Christian Brabandt

unread,
Apr 26, 2026, 1:00:15 PMApr 26
to vim...@googlegroups.com
patch 9.2.0397: tabpanel: double-click opens a new tab

Commit: https://github.com/vim/vim/commit/22aedc4a902812a2a53b713dbe3c82b77f2f167d
Author: Yasuhiro Matsumoto <matt...@gmail.com>
Date: Sun Apr 26 16:47:08 2026 +0000

patch 9.2.0397: tabpanel: double-click opens a new tab

Problem: tabpanel: double-click opens a new tab page
Solution: Do not create a new tab page when using a double click
(Yasuhiro Matsumoto).

The tabpanel click handler inherited the tabline behavior where a
double-click opens a new, empty tab page. Unlike the tabline, the
tabpanel has no "empty area": every row maps to some tab, so this
fires on any double-click in the tabpanel and can generate stray
empty tabs. The behavior is also not documented for the tabpanel.

Skip the new-tab branch when the click originated in the tabpanel
and fall through to the regular tab-switch path instead. The
tabline behavior is unchanged.

closes: #20044

Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt
index 508361891..7fc09c545 100644
--- a/runtime/doc/tabpage.txt
+++ b/runtime/doc/tabpage.txt
@@ -1,4 +1,4 @@
-*tabpage.txt* For Vim version 9.2. Last change: 2026 Apr 25
+*tabpage.txt* For Vim version 9.2. Last change: 2026 Apr 26


VIM REFERENCE MANUAL by Bram Moolenaar
@@ -513,6 +513,16 @@ The scrollbar uses the |hl-PmenuSbar| highlight group for the track and
The scroll offset is remembered across redraws but is reset when "scroll" or
"scrollbar" is toggled off and back on.

+MOUSE CLICKS IN THE TABPANEL: *tabpanel-mouse*
+
+A left click on a row in the tabpanel selects the tab page that the row
+belongs to. Unlike the tabline, a double click in the tabpanel does not
+open a new, empty tab page; it is treated the same as a single click.
+
+For finer-grained control, the 'tabpanel' value may contain |stl-%[FuncName]|
+click regions. Clicks on those regions are dispatched to the callback
+function instead of falling through to tab selection.
+
==============================================================================
6. Setting 'guitablabel' *setting-guitablabel*

diff --git a/runtime/doc/tags b/runtime/doc/tags
index 80b1d18be..65edb2c31 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -10893,6 +10893,7 @@ tabpagebuflist() builtin.txt /*tabpagebuflist()*
tabpagenr() builtin.txt /*tabpagenr()*
tabpagewinnr() builtin.txt /*tabpagewinnr()*
tabpanel tabpage.txt /*tabpanel*
+tabpanel-mouse tabpage.txt /*tabpanel-mouse*
tabpanel-scroll tabpage.txt /*tabpanel-scroll*
tag tagsrch.txt /*tag*
tag-! tagsrch.txt /*tag-!*
diff --git a/src/mouse.c b/src/mouse.c
index 93fdd3182..ddd94fffc 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -591,9 +591,13 @@ do_mouse(
c1 = tp_label.nr;
if (c1 >= 0)
{
- if ((mod_mask & MOD_MASK_MULTI_CLICK) == MOD_MASK_2CLICK)
+ if ((mod_mask & MOD_MASK_MULTI_CLICK) == MOD_MASK_2CLICK
+ && !tp_label.is_panel)
{
- // double click opens new page
+ // Double-click on the tabline opens a new, empty tab page.
+ // The tabpanel has no "empty area" (every row maps to a tab)
+ // and this behavior is not documented for tabpanel, so fall
+ // through to the regular tab-switch path there.
end_visual_mode_keep_button();
tabpage_new();
tabpage_move(c1 == 0 ? 9999 : c1 - 1);
diff --git a/src/version.c b/src/version.c
index e714ddc2a..1649c0ff8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 397,
/**/
396,
/**/
Reply all
Reply to author
Forward
0 new messages