patch 9.1.0572: cannot specify tab page closing behaviour

Problem:  cannot specify tab page closing behaviour
          (Gianluca Pacchiella)
Solution: Add the 'tabclose' option (LemonBoy).

fixes: #5967
closes: #15204

Signed-off-by: LemonBoy <thatlemon@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 2dc08e2..5f1a2a0 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -8100,6 +8100,19 @@
 	'S' flag in 'cpoptions'.
 	Only normal file name characters can be used, "/\*?[|<>" are illegal.
 
+						*'tabclose'* *'tcl'*
+'tabclose' 'tcl'	string	(default "")
+			global
+	This option controls the behavior when closing tab pages (e.g., using
+	|:tabclose|).  When empty Vim goes to the next (right) tab page.
+
+	Possible values (comma-separated list):
+	   left		If included, go to the previous tab page instead of
+			the next one.
+	   uselast	If included, go to the previously used tab page if
+			possible.  This option takes precedence over the
+			others.
+
 						*'tabline'* *'tal'*
 'tabline' 'tal'		string	(default empty)
 			global
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index 517fa30..42b5228 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -935,6 +935,7 @@
 'switchbuf'	  'swb'     sets behavior when switching to another buffer
 'synmaxcol'	  'smc'     maximum column to find syntax items
 'syntax'	  'syn'     syntax to be loaded for current buffer
+'tabclose'	  'tcl'     which tab page to focus when closing a tab
 'tabline'	  'tal'     custom format for the console tab pages line
 'tabpagemax'	  'tpm'     maximum number of tab pages for |-p| and "tab all"
 'tabstop'	  'ts'	    number of spaces that <Tab> in file uses
diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt
index abbc778..afc2512 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 May 15
+*tabpage.txt*   For Vim version 9.1.  Last change: 2024 Jul 12
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -142,7 +142,8 @@
 		    :tabclose $	    " close the last tab page
 		    :tabclose #     " close the last accessed tab page
 
-When a tab is closed the next tab page will become the current one.
+When a tab is closed the next tab page will become the current one. This
+behaviour can be customized using the 'tabclose' option.
 
 							*:tabo* *:tabonly*
 :tabo[nly][!]	Close all other tab pages.
diff --git a/runtime/doc/tags b/runtime/doc/tags
index b3761e8..00c216c 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -1161,6 +1161,7 @@
 't_xo'	term.txt	/*'t_xo'*
 't_xs'	term.txt	/*'t_xs'*
 'ta'	options.txt	/*'ta'*
+'tabclose'	options.txt	/*'tabclose'*
 'tabline'	options.txt	/*'tabline'*
 'tabpagemax'	options.txt	/*'tabpagemax'*
 'tabstop'	options.txt	/*'tabstop'*
@@ -1179,6 +1180,7 @@
 'tbis'	options.txt	/*'tbis'*
 'tbs'	options.txt	/*'tbs'*
 'tc'	options.txt	/*'tc'*
+'tcl'	options.txt	/*'tcl'*
 'tcldll'	options.txt	/*'tcldll'*
 'tenc'	options.txt	/*'tenc'*
 'term'	options.txt	/*'term'*
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index 7a2cbe4..3b719eb 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -1,4 +1,4 @@
-*version9.txt*  For Vim version 9.1.  Last change: 2024 Jul 11
+*version9.txt*  For Vim version 9.1.  Last change: 2024 Jul 12
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -41632,6 +41632,7 @@
 Options: ~
 
 'winfixbuf'		Keep buffer focused in a window
+'tabclose'		Which tab page to focus after closing a tab page
 't_xo'			Terminal uses XON/XOFF handshaking (e.g. vt420)
 't_CF'			Support for alternate font highlighting terminal code