patch 9.1.1391: Vim does not have a vertical tabpanel

Problem:  Vim does not have a tabpanel
Solution: include the tabpanel feature
          (Naruhiko Nishino, thinca)

closes: #17263

Co-authored-by: thinca <thinca@gmail.com>
Signed-off-by: Naruhiko Nishino <naru123456789@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index b9d0719..717f13a 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -1,4 +1,4 @@
-*builtin.txt*	For Vim version 9.1.  Last change: 2025 May 09
+*builtin.txt*	For Vim version 9.1.  Last change: 2025 May 14
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -4730,6 +4730,8 @@
 		If not over a window, e.g. when in the command line, then only
 		"screenrow" and "screencol" are valid, the others are zero.
 
+		When on the |tabpanel|, "wincol" value is zero.
+
 		When on the status line below a window or the vertical
 		separator right of a window, the "line" and "column" values
 		are zero.
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 024102c..00a09ae 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt*     For Vim version 9.1.  Last change: 2025 Mar 18
+*index.txt*     For Vim version 9.1.  Last change: 2025 May 14
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1583,6 +1583,7 @@
 |:redraw|	:redr[aw]	  force a redraw of the display
 |:redrawstatus|	:redraws[tatus]	  force a redraw of the status line(s)
 |:redrawtabline|  :redrawt[abline]  force a redraw of the tabline
+|:redrawtabpanel| :redrawtabp[anel] force a redraw of the tabpanel
 |:registers|	:reg[isters]	display the contents of registers
 |:resize|	:res[ize]	change current window height
 |:retab|	:ret[ab]	change tab size
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 5563a05..274d56e 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt*	For Vim version 9.1.  Last change: 2025 May 10
+*options.txt*	For Vim version 9.1.  Last change: 2025 May 14
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -3657,11 +3657,12 @@
 	  trunc		'>'		truncated text in the
 					|ins-completion-menu|.
 	  truncrl	'<'		same as "trunc" in 'rightleft' mode
+	  tpl_vert	'|'		vertical separators of 'tabpanel'
 
 	Any one that is omitted will fall back to the default.
 
 	Example: >
-	    :set fillchars=stl:\ ,stlnc:\ ,vert:\|,fold:-,diff:-
+	    :set fillchars=stl:\ ,stlnc:\ ,vert:\|,fold:-,diff:-,tpl_vert:\|
 <
 	All items support single-byte and multibyte characters.  But
 	double-width characters are not supported. |E1512|
@@ -7689,6 +7690,20 @@
 	line.
 	See |tab-page| for more information about tab pages.
 
+						*'showtabpanel'* *'stpl'*
+'showtabpanel' 'stpl'	number	(default 0)
+			global
+			{not in Vi}
+			{not available when compiled without the |+tabpanel|
+			feature}
+	The value of this option specifies when the |tabpanel| with tab page
+	labels will be displayed:
+		0: never
+		1: only if there are at least two tab pages
+		2: always
+	This is for the non-GUI implementation of the tabpanel only.
+	See |tab-page| for more information about tab page labels.
+
 						*'sidescroll'* *'ss'*
 'sidescroll' 'ss'	number	(default 0)
 			global
@@ -8408,6 +8423,71 @@
 	Maximum number of tab pages to be opened by the |-p| command line
 	argument or the ":tab all" command. |tabpage|
 
+				*'tabpanel'* *'tpl'* *g:actual_curtabpage*
+'tabpanel' 'tpl'			string	(default empty)
+			global
+			{not in Vi}
+	When non empty, this option determines the content of the |tabpanel|.
+	The option consists of printf style '%' items interspersed with
+	normal text, similar to the 'statusline' or 'tabline'.
+
+	When changing something that is used in 'tabpanel' that does not
+	trigger it to be updated, use |:redrawtabpanel|.
+	This option cannot be set in a modeline when 'modelineexpr' is off.
+
+	You can use |g:actual_curtabpage| within a function assigned to
+	tabpanel. |g:actual_curtabpage| represents current tab's label number.
+	This option can contain line breaks:
+>
+	set tabpanel=%!TabPanel()
+	function! TabPanel() abort
+	  return printf("(%2d)\n  %%f", g:actual_curtabpage)
+	endfunction
+<
+	The result is:
+>
+	+-----------+---------------------------------
+	|(1)        |
+	|  ~/aaa.txt|
+	|(2)        |
+	|  ~/.vimrc |
+	|           |
+	|           |
+	|           |
+<
+
+					*'tabpanelopt'* *'tplo'*
+'tabpanelopt' 'tplo'		string	(default "")
+			global
+			{not in Vi}
+	Optional settings for the |tabpanel|,  It can consist of the following
+	items.  Items must be separated by a comma.
+
+		align:{text}	Specified the position of tabpanel.
+				Currently supported positions are:
+
+				left	left-aligned
+				right	right-aligned
+
+				(default "left")
+
+		columns:{n}	Use the size (in char) of tabpanel.
+				The tabpanel is never shown when using zero
+				or less than the size of Vim window.
+				(default 20)
+
+		vert		Use a vertical separator for tabpanel.
+				This vertical separator is used "tpl_vert" of
+				'fillchars'.
+				(default off)
+
+	Examples: >
+		:set tabpanelopt=columns:16,align:right
+		:set tabpanelopt=
+		:set tabpanelopt=vert,align:right
+		:set tabpanelopt=columns:16
+<
+
 						*'tabstop'* *'ts'*
 'tabstop' 'ts'		number	(default 8)
 			local to buffer
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index ed72830..c33b356 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -1,4 +1,4 @@
-*syntax.txt*	For Vim version 9.1.  Last change: 2025 Apr 28
+*syntax.txt*	For Vim version 9.1.  Last change: 2025 May 10
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -5991,6 +5991,12 @@
 TabLineFill	Tab pages line, where there are no labels.
 							*hl-TabLineSel*
 TabLineSel	Tab pages line, active tab page label.
+							*hl-TabPanel*
+TabPanel	TabPanel, not active tab page label.
+							*hl-TabPanelFill*
+TabPanelFill	TabPanel, where there are no labels.
+							*hl-TabPanelSel*
+TabPanelSel	TabPanel, active tab page label.
 							*hl-Terminal*
 Terminal	|terminal| window (see |terminal-size-color|).
 							*hl-Title*
diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt
index afc2512..e17d533 100644
--- a/runtime/doc/tabpage.txt
+++ b/runtime/doc/tabpage.txt
@@ -1,4 +1,4 @@
-*tabpage.txt*   For Vim version 9.1.  Last change: 2024 Jul 12
+*tabpage.txt*   For Vim version 9.1.  Last change: 2025 May 14
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -14,7 +14,8 @@
 2. Commands			|tab-page-commands|
 3. Other items			|tab-page-other|
 4. Setting 'tabline'		|setting-tabline|
-5. Setting 'guitablabel'	|setting-guitablabel|
+5. Setting 'tabpanel'		|setting-tabpanel|
+6. Setting 'guitablabel'	|setting-guitablabel|
 
 {not able to use multiple tab pages when the |+windows| feature was disabled
 at compile time}
@@ -364,8 +365,8 @@
 labels.  This isn't easy, thus an example will be given here.
 
 For basics see the 'statusline' option.  The same items can be used in the
-'tabline' option.  Additionally, the |tabpagebuflist()|, |tabpagenr()| and
-|tabpagewinnr()| functions are useful.
+'tabline' and 'tabpanel' option.  Additionally, the |tabpagebuflist()|,
+|tabpagenr()| and |tabpagewinnr()| functions are useful.
 
 Since the number of tab labels will vary, you need to use an expression for
 the whole option.  Something like: >
@@ -418,7 +419,74 @@
 space available.
 
 ==============================================================================
-5. Setting 'guitablabel'				*setting-guitablabel*
+5. Setting 'tabpanel'				*tabpanel* *setting-tabpanel*
+
+The tabpanel is a vertical sidebar that displays tab page labels along the
+side of the window.  It looks like this:
+>
+	+-----------+----------------------------------
+	|(1)        |text text text text text text text
+	|  ~/aaa.txt|text text text text text text text
+	|(2)        |text text text text text text text
+	|  ~/.vimrc |text text text text text text text
+	|(3)        |text text text text text text text
+	|  ~/bbb.js |text text text text text text text
+	|  ~/ccc.css|text text text text text text text
+	|           |text text text text text text text
+	|           |text text text text text text text
+	|           |text text text text text text text
+<
+To configure the tabpanel, use following options: 'tabpanel',
+'showtabpanel', 'tabpanelopt'.
+The 'tabpanel' and 'showtabpanel' options are function similar to the
+'statusline' or 'tabline'.
+
+The "columns:" of 'tabpanelopt' option specifies the width of the tabpanel:
+>
+              +------ This width
+              |
+         <----+----->
+	+-----------+----------------------------------
+	|(1)        |text text text text text text text
+	|  ~/aaa.txt|text text text text text text text
+	|(2)        |text text text text text text text
+<
+The "align:" of 'tabpanelopt' option determines whether the tabpanel is
+displayed on the right side of the window:
+>
+	+----------------------------------+-----------
+	|text text text text text text text|(1)
+	|text text text text text text text|  ~/aaa.txt
+	|text text text text text text text|(2)
+<
+The "wrap" of 'tabpanelopt' option controls whether lines in tabpanel are
+wraped:
+>
+	+-----------+----------------------------------
+	|(1)        |text text text text text text text
+	|  ~/long_lo|text text text text text text text
+	|ng_file_nam|text text text text text text text
+	|e.txt      |text text text text text text text
+	|(2)        |text text text text text text text
+
+The "vert" of 'tabpanelopt' option defines whether a vertical separator is
+displayed between the tabpanel and the main window:
+>
+                    +------ This is
+                    |
+                    v
+	+-----------+----------------------------------
+	|(1)        |text text text text text text text
+	|  ~/aaa.txt|text text text text text text text
+	|(2)        |text text text text text text text
+<
+The vertical separator is used "tpl_vert" of 'fillchars'.
+
+You can customize the appearance of the tab page labels using the highlight
+groups: |hl-TabPanel| |hl-TabPanelSel| |hl-TabPanelFill|
+
+==============================================================================
+6. Setting 'guitablabel'				*setting-guitablabel*
 
 When the GUI tab pages line is displayed, 'guitablabel' can be used to
 specify the label to display for each tab page.  Unlike 'tabline', which
diff --git a/runtime/doc/tags b/runtime/doc/tags
index b820c96..e586212 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -959,6 +959,7 @@
 'showmatch'	options.txt	/*'showmatch'*
 'showmode'	options.txt	/*'showmode'*
 'showtabline'	options.txt	/*'showtabline'*
+'showtabpanel'	options.txt	/*'showtabpanel'*
 'shq'	options.txt	/*'shq'*
 'si'	options.txt	/*'si'*
 'sidescroll'	options.txt	/*'sidescroll'*
@@ -1012,6 +1013,7 @@
 'statusline'	options.txt	/*'statusline'*
 'stl'	options.txt	/*'stl'*
 'stmp'	options.txt	/*'stmp'*
+'stpl'	options.txt	/*'stpl'*
 'sts'	options.txt	/*'sts'*
 'su'	options.txt	/*'su'*
 'sua'	options.txt	/*'sua'*
@@ -1183,6 +1185,8 @@
 'tabclose'	options.txt	/*'tabclose'*
 'tabline'	options.txt	/*'tabline'*
 'tabpagemax'	options.txt	/*'tabpagemax'*
+'tabpanel'	options.txt	/*'tabpanel'*
+'tabpanelopt'	options.txt	/*'tabpanelopt'*
 'tabstop'	options.txt	/*'tabstop'*
 'tag'	options.txt	/*'tag'*
 'tagbsearch'	options.txt	/*'tagbsearch'*
@@ -1233,6 +1237,8 @@
 'toolbar'	options.txt	/*'toolbar'*
 'toolbariconsize'	options.txt	/*'toolbariconsize'*
 'top'	options.txt	/*'top'*
+'tpl'	options.txt	/*'tpl'*
+'tplo'	options.txt	/*'tplo'*
 'tpm'	options.txt	/*'tpm'*
 'tr'	options.txt	/*'tr'*
 'ts'	options.txt	/*'ts'*
@@ -1478,6 +1484,7 @@
 +sun_workshop	various.txt	/*+sun_workshop*
 +syntax	various.txt	/*+syntax*
 +system()	various.txt	/*+system()*
++tabpanel	various.txt	/*+tabpanel*
 +tag_any_white	various.txt	/*+tag_any_white*
 +tag_binary	various.txt	/*+tag_binary*
 +tag_old_static	various.txt	/*+tag_old_static*
@@ -3141,6 +3148,8 @@
 :redrawstatus	various.txt	/*:redrawstatus*
 :redrawt	various.txt	/*:redrawt*
 :redrawtabline	various.txt	/*:redrawtabline*
+:redrawtabp	various.txt	/*:redrawtabp*
+:redrawtabpanel	various.txt	/*:redrawtabpanel*
 :reg	change.txt	/*:reg*
 :registers	change.txt	/*:registers*
 :res	windows.txt	/*:res*
@@ -4630,6 +4639,7 @@
 E154	helphelp.txt	/*E154*
 E1540	eval.txt	/*E1540*
 E1541	vi_diff.txt	/*E1541*
+E1547	various.txt	/*E1547*
 E155	sign.txt	/*E155*
 E156	sign.txt	/*E156*
 E157	sign.txt	/*E157*
@@ -7589,6 +7599,7 @@
 g:Netrw_funcref	pi_netrw.txt	/*g:Netrw_funcref*
 g:Openprg	eval.txt	/*g:Openprg*
 g:actual_curbuf	options.txt	/*g:actual_curbuf*
+g:actual_curtabpage	options.txt	/*g:actual_curtabpage*
 g:actual_curwin	options.txt	/*g:actual_curwin*
 g:ada#Comment	ft_ada.txt	/*g:ada#Comment*
 g:ada#Ctags_Kinds	ft_ada.txt	/*g:ada#Ctags_Kinds*
@@ -8272,6 +8283,9 @@
 hl-TabLine	syntax.txt	/*hl-TabLine*
 hl-TabLineFill	syntax.txt	/*hl-TabLineFill*
 hl-TabLineSel	syntax.txt	/*hl-TabLineSel*
+hl-TabPanel	syntax.txt	/*hl-TabPanel*
+hl-TabPanelFill	syntax.txt	/*hl-TabPanelFill*
+hl-TabPanelSel	syntax.txt	/*hl-TabPanelSel*
 hl-Terminal	syntax.txt	/*hl-Terminal*
 hl-Title	syntax.txt	/*hl-Title*
 hl-ToolbarButton	gui.txt	/*hl-ToolbarButton*
@@ -10063,6 +10077,7 @@
 setting-guifont	gui.txt	/*setting-guifont*
 setting-guitablabel	tabpage.txt	/*setting-guitablabel*
 setting-tabline	tabpage.txt	/*setting-tabline*
+setting-tabpanel	tabpage.txt	/*setting-tabpanel*
 setuid	change.txt	/*setuid*
 setwinvar()	builtin.txt	/*setwinvar()*
 sftp	pi_netrw.txt	/*sftp*
@@ -10653,6 +10668,7 @@
 tabpagebuflist()	builtin.txt	/*tabpagebuflist()*
 tabpagenr()	builtin.txt	/*tabpagenr()*
 tabpagewinnr()	builtin.txt	/*tabpagewinnr()*
+tabpanel	tabpage.txt	/*tabpanel*
 tag	tagsrch.txt	/*tag*
 tag-!	tagsrch.txt	/*tag-!*
 tag-binary-search	tagsrch.txt	/*tag-binary-search*
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index b68c336..00b79f4 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -1,4 +1,4 @@
-*various.txt*   For Vim version 9.1.  Last change: 2025 Apr 21
+*various.txt*   For Vim version 9.1.  Last change: 2025 May 14
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -36,6 +36,12 @@
 			'tabline' includes an item that doesn't trigger
 			automatic updating.
 
+				*E1547* *:redrawtabp* *:redrawtabpanel*
+:redrawtabp[anel]	Redraw the tabline.  Useful to update the tabpanel
+			when 'tabpanel' includes an item that doesn't trigger
+			automatic updating.
+
+
 							*N<Del>*
 <Del>			When entering a number: Remove the last digit.
 			Note: if you like to use <BS> for this, add this
@@ -491,6 +497,7 @@
 -  *+sun_workshop*	Removed: |workshop|
 N  *+syntax*		Syntax highlighting |syntax|
    *+system()*		Unix only: opposite of |+fork|
+H  *+tabpanel*		Support for |tabpanel|
 T  *+tag_binary*	binary searching in tags file |tag-binary-search|
 -  *+tag_old_static*	Removed; method for static tags |tag-old-static|
 -  *+tag_any_white*	Removed; was to allow any white space in tags files
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index 371e4b3..5242842 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -1,4 +1,4 @@
-*version9.txt*  For Vim version 9.1.  Last change: 2025 May 08
+*version9.txt*  For Vim version 9.1.  Last change: 2025 May 14
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -41584,6 +41584,8 @@
 
 Support for the |Tuple| data type in Vim script and Vim9 script.
 
+Support for a vertical |tabpanel| window similar to the 'tabline'.
+
 							*changed-9.2*
 Changed~
 -------
@@ -41732,6 +41734,9 @@
 |hl-PmenuMatch|		Popup menu: highlighting of matched text
 |hl-PmenuMatchSel|	Popup menu: highlighting of matched text in selected
 			line
+|hl-TabPanel|		|tabpanel|: not active tab page label
+|hl-TabPanelFill|	|tabpanel|: filler space
+|hl-TabPanelSel|	|tabpanel|: active tab page label
 
 Commands: ~
 
@@ -41742,6 +41747,7 @@
 |:iput|			like |:put| but adjust indent
 |:pbuffer|		Edit buffer [N] from the buffer list in the preview
 			window
+|:redrawtabpanel|	Force updating the 'tabpanel'.
 
 Options: ~
 
@@ -41757,7 +41763,11 @@
 'lhistory'		Size of the location list stack |quickfix-stack|.
 'messagesopt'		configure |:messages| and |hit-enter| prompt
 'pummaxwidth'		maximum width for the completion popup menu
+'showtabpanel'		When to show the |tabpanel|
 'tabclose'		Which tab page to focus after closing a tab page
+'tabpanel'		Optional vertical panel for displaying tabpages
+			|tabpanel|
+'tabpanelopt'		Optional settings for the |tabpanel|
 't_xo'			Terminal uses XON/XOFF handshaking (e.g. vt420)
 't_CF'			Support for alternate font highlighting terminal code
 'winfixbuf'		Keep buffer focused in a window