patch 9.1.0864: message history is fixed to 200

Problem:  message history is fixed to 200
Solution: Add the 'msghistory' option, increase the default
          value to 500 (Shougo Matsushita)

closes: #16048

Co-authored-by: Milly <milly.ca@gmail.com>
Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt
index 6453b95..69d8bc7 100644
--- a/runtime/doc/message.txt
+++ b/runtime/doc/message.txt
@@ -1,4 +1,4 @@
-*message.txt*   For Vim version 9.1.  Last change: 2024 Mar 13
+*message.txt*   For Vim version 9.1.  Last change: 2024 Nov 14
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -29,7 +29,7 @@
 				Clear messages, keeping only the {count} most
 				recent ones.
 
-The number of remembered messages is fixed at 200.
+The number of remembered messages is determined by the 'msghistory' option.
 
 								*g<*
 The "g<" command can be used to see the last page of previous command output.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 73ff7cc..1aa5ccc 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4440,7 +4440,8 @@
 			global
 	A history of ":" commands, and a history of previous search patterns
 	is remembered.  This option decides how many entries may be stored in
-	each of these histories (see |cmdline-editing|).
+	each of these histories (see |cmdline-editing| and 'msghistory' for
+	the number of messages to remember).
 	The maximum value is 10000.
 	NOTE: This option is set to the Vi default value when 'compatible' is
 	set and to the Vim default value when 'compatible' is reset.
@@ -5917,6 +5918,12 @@
 	time in msec between two mouse clicks for the second click to be
 	recognized as a multi click.
 
+						*'msghistory'* *'mhi'*
+'msghistory' 'mhi'	number	(default 500)
+			global
+	Determines how many entries are remembered in the |:messages| history.
+	The maximum value is 10000.
+
 						    *'mzquantum'* *'mzq'*
 'mzquantum' 'mzq'	number	(default 100)
 			global
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 00c131d..86db8a4 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -501,6 +501,7 @@
 'mesg'	vi_diff.txt	/*'mesg'*
 'mfd'	options.txt	/*'mfd'*
 'mh'	options.txt	/*'mh'*
+'mhi'	options.txt	/*'mhi'*
 'mis'	options.txt	/*'mis'*
 'mkspellmem'	options.txt	/*'mkspellmem'*
 'ml'	options.txt	/*'ml'*
@@ -531,6 +532,7 @@
 'mousetime'	options.txt	/*'mousetime'*
 'mp'	options.txt	/*'mp'*
 'mps'	options.txt	/*'mps'*
+'msghistory'	options.txt	/*'msghistory'*
 'msm'	options.txt	/*'msm'*
 'mzq'	options.txt	/*'mzq'*
 'mzquantum'	options.txt	/*'mzquantum'*
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index ac0700e..10e13f8 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 Nov 11
+*version9.txt*  For Vim version 9.1.  Last change: 2024 Nov 14
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -41659,6 +41659,7 @@
 			popup
 'findfunc'		Vim function to obtain the results for a |:find|
 			command
+'msghistory'		Max number of messages to remember
 '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)
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 99b1ecf..c8170da 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -749,6 +749,8 @@
 call <SID>BinOptionG("terse", &terse)
 call <SID>AddOption("shortmess", gettext("list of flags to make messages shorter"))
 call <SID>OptionG("shm", &shm)
+call <SID>AddOption("msghistory", gettext("how many messages are remembered"))
+call append("$", " \tset mhi=" . &mhi)
 call <SID>AddOption("showcmd", gettext("show (partial) command keys in location given by 'showcmdloc'"))
 let &sc = s:old_sc
 call <SID>BinOptionG("sc", &sc)