patch 9.1.1283: quickfix stack is limited to 10 items

Problem:  quickfix and location-list stack is limited to 10 items
Solution: add the 'chistory' and 'lhistory' options to configure a
          larger quickfix/location list stack
          (64-bitman)

closes: #16920

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: 64-bitman <60551350+64-bitman@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index e2206f0..962a6e7 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 Apr 04
+*options.txt*	For Vim version 9.1.  Last change: 2025 Apr 06
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -1717,6 +1717,19 @@
 	This option cannot be set from a |modeline| or in the |sandbox|, for
 	security reasons.
 
+						*'chistory'* *'chi'*
+'chistory' 'chi'	number	(default: 10)
+			global
+			{only available when compiled with the |+quickfix|
+			feature}
+	Number of quickfix lists that should be remembered for the quickfix
+	stack.  Must be between 1 and 100.  If the option is set to a value
+	that is lower than the amount of entries in the quickfix list stack,
+	entries will be removed starting from the oldest one.  If the current
+	quickfix list was removed, then the quickfix list at top of the stack
+	(the most recently created) will be used in its place.  For additional
+	info, see |quickfix-stack|.
+
 				   *'cindent'* *'cin'* *'nocindent'* *'nocin'*
 'cindent' 'cin'		boolean	(default off)
 			local to buffer
@@ -5316,6 +5329,19 @@
 	temporarily when performing an operation where redrawing may cause
 	flickering or cause a slowdown.
 
+						*'lhistory'* *'lhi'*
+'lhistory' 'lhi'	number	(default: 10)
+			local to window
+			{only available when compiled with the |+quickfix|
+			feature}
+	Like 'chistory', but for the location list stack associated with the
+	current window.  If the option is changed in either the location list
+	window itself or the the window that is associated with the location
+	list stack, the new value will also be applied to the other one.  This
+	means this value will always be the same for a given location list
+	window and its corresponding window.  See |quickfix-stack| for
+	additional info.
+
 			*'linebreak'* *'lbr'* *'nolinebreak'* *'nolbr'*
 'linebreak' 'lbr'	boolean	(default off)
 			local to window
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index 91e4863..a9a43fe 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -1,4 +1,4 @@
-*quickfix.txt*  For Vim version 9.1.  Last change: 2025 Mar 11
+*quickfix.txt*  For Vim version 9.1.  Last change: 2025 Apr 06
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -43,12 +43,12 @@
 The 'errorformat' option should be set to match the error messages from your
 compiler (see |errorformat| below).
 
-							*quickfix-ID*
+					*quickfix-stack* *quickfix-ID*
 Each quickfix list has a unique identifier called the quickfix ID and this
 number will not change within a Vim session. The |getqflist()| function can be
 used to get the identifier assigned to a list. There is also a quickfix list
-number which may change whenever more than ten lists are added to a quickfix
-stack.
+number which may change whenever more than 'chistory' lists are added to a
+quickfix stack.
 
 						*location-list* *E776*
 A location list is a window-local quickfix list. You get one after commands
@@ -860,10 +860,12 @@
 =============================================================================
 3. Using more than one list of errors			*quickfix-error-lists*
 
-So far has been assumed that there is only one list of errors.  Actually the
-ten last used lists are remembered.  When starting a new list, the previous
-ones are automatically kept.  Two commands can be used to access older error
-lists.  They set one of the existing error lists as the current one.
+So far it has been assumed that there is only one list of errors.  Actually
+there can be multiple used lists that are remembered; see 'chistory' and
+'lhistory'.
+When starting a new list, the previous ones are automatically kept.  Two
+commands can be used to access older error lists.  They set one of the
+existing error lists as the current one.
 
 						*:colder* *:col* *E380*
 :col[der] [count]	Go to older error list.  When [count] is given, do
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index 87764a2..349c1af 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -1,4 +1,4 @@
-*quickref.txt*  For Vim version 9.1.  Last change: 2025 Feb 08
+*quickref.txt*  For Vim version 9.1.  Last change: 2025 Apr 06
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -639,6 +639,7 @@
 'cdpath'	  'cd'	    list of directories searched with ":cd"
 'cedit'			    key used to open the command-line window
 'charconvert'	  'ccv'     expression for character encoding conversion
+'chistory'	  'chi'     maximum number of quickfix lists in history
 'cindent'	  'cin'     do C program indenting
 'cinkeys'	  'cink'    keys that trigger indent when 'cindent' is set
 'cinoptions'	  'cino'    how to do indenting when 'cindent' is set
@@ -786,6 +787,7 @@
 'langremap'	  'lrm'	    do apply 'langmap' to mapped characters
 'laststatus'	  'ls'	    tells when last window has status lines
 'lazyredraw'	  'lz'	    don't redraw while executing macros
+'lhistory'	  'lhi'	    maximum number of location lists in history
 'linebreak'	  'lbr'     wrap long lines at a blank
 'lines'			    number of lines in the display
 'linespace'	  'lsp'     number of pixel lines to use between characters
diff --git a/runtime/doc/tags b/runtime/doc/tags
index acb2251..e55623d 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -134,6 +134,8 @@
 'ch'	options.txt	/*'ch'*
 'character'	intro.txt	/*'character'*
 'charconvert'	options.txt	/*'charconvert'*
+'chi'	options.txt	/*'chi'*
+'chistory'	options.txt	/*'chistory'*
 'ci'	options.txt	/*'ci'*
 'cia'	options.txt	/*'cia'*
 'cin'	options.txt	/*'cin'*
@@ -463,6 +465,8 @@
 'lazyredraw'	options.txt	/*'lazyredraw'*
 'lbr'	options.txt	/*'lbr'*
 'lcs'	options.txt	/*'lcs'*
+'lhi'	options.txt	/*'lhi'*
+'lhistory'	options.txt	/*'lhistory'*
 'linebreak'	options.txt	/*'linebreak'*
 'lines'	options.txt	/*'lines'*
 'linespace'	options.txt	/*'linespace'*
@@ -9768,6 +9772,7 @@
 quickfix-parse	quickfix.txt	/*quickfix-parse*
 quickfix-perl	quickfix.txt	/*quickfix-perl*
 quickfix-size	quickfix.txt	/*quickfix-size*
+quickfix-stack	quickfix.txt	/*quickfix-stack*
 quickfix-title	quickfix.txt	/*quickfix-title*
 quickfix-valid	quickfix.txt	/*quickfix-valid*
 quickfix-window	quickfix.txt	/*quickfix-window*
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index b7b2bcc..48d0941 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 Apr 03
+*version9.txt*  For Vim version 9.1.  Last change: 2025 Apr 06
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -41729,6 +41729,7 @@
 
 Options: ~
 
+'chistory'		Size of the quickfix stack |quickfix-stack|.
 'completefuzzycollect'	Enable fuzzy collection of candiates for (some)
 			|ins-completion| modes
 'completeitemalign'	Order of |complete-items| in Insert mode completion
@@ -41736,6 +41737,8 @@
 'eventignorewin'	autocommand events that are ignored in a window
 'findfunc'		Vim function to obtain the results for a |:find|
 			command
+'lhistory'		Size of the location list stack |quickfix-stack|.
+'completefuzzycollect'	Enable fuzzy collection of candiates for (some)
 'messagesopt'		configure |:messages| and |hit-enter| prompt
 'winfixbuf'		Keep buffer focused in a window
 'tabclose'		Which tab page to focus after closing a tab page