]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0864: message history is fixed to 200 v9.1.0864
authorShougo Matsushita <Shougo.Matsu@gmail.com>
Thu, 14 Nov 2024 21:31:48 +0000 (22:31 +0100)
committerChristian Brabandt <cb@256bit.org>
Thu, 14 Nov 2024 21:34:24 +0000 (22:34 +0100)
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>
13 files changed:
runtime/doc/message.txt
runtime/doc/options.txt
runtime/doc/tags
runtime/doc/version9.txt
runtime/optwin.vim
src/feature.h
src/message.c
src/option.c
src/option.h
src/optiondefs.h
src/testdir/gen_opt_test.vim
src/testdir/test_options.vim
src/version.c

index 6453b95fabfb073306c914a799fe4957383f7e81..69d8bc7c6ffde436dc74395b42f67ec8b729f6a2 100644 (file)
@@ -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 @@ depends on the 'shortmess' option.
                                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.
index 73ff7cc600ac4fcd56d469540f000776472c427a..1aa5cccf7d755b1eb6a48e6bbb670fc7385db459 100644 (file)
@@ -4440,7 +4440,8 @@ A jump table for the options with a short description can be found at |Q_op|.
                        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 @@ A jump table for the options with a short description can be found at |Q_op|.
        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
index 00c131d800df701dd33b3b4afffc4fba250eeb45..86db8a41d76cffd04060714d8e24433e5c3bd273 100644 (file)
@@ -501,6 +501,7 @@ $quote      eval.txt        /*$quote*
 '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 @@ $quote      eval.txt        /*$quote*
 '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'*
index ac0700ed79cc8577ff7576a567350a04ca3ca681..10e13f846ac24b29412e47d70ea8a570952f93b4 100644 (file)
@@ -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 @@ Options: ~
                        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)
index 99b1ecfd21489989b66b18018414ba772e8af353..c8170da71d0737473fc5f5739913fef41424a9f2 100644 (file)
@@ -749,6 +749,8 @@ call <SID>AddOption("terse", gettext("add 's' flag in 'shortmess' (don't show se
 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)
index 5fcd727a9eaeb148d34e406fe52438613c739839..bcfc4a40c0a2efc9578c3f571cb0e0d85d1afe09 100644 (file)
  *                     main window area.
  */
 
-/*
- * Message history is fixed at 200 messages.
- */
-#define MAX_MSG_HIST_LEN 200
-
 /*
  * +folding            Fold lines.
  */
index 576d92268e8709f1efd7b26183f508ff221b596d..5853e471feff4f40b0cc64e8e7d0fbe78a3c6a3c 100644 (file)
@@ -1013,7 +1013,7 @@ add_msg_hist(
        return;
 
     // Don't let the message history get too big
-    while (msg_hist_len > MAX_MSG_HIST_LEN)
+    while (msg_hist_len > p_mhi)
        (void)delete_first_msg();
 
     // allocate an entry and add the message at the end of the history
index dcb5752e188cfe07907a4a092c8a590e8f454354..4616d63d36f8369f2f1d09997afec8acce1be378 100644 (file)
@@ -4914,6 +4914,16 @@ check_num_option_bounds(
        errmsg = e_invalid_argument;
        p_hi = 10000;
     }
+    if (p_mhi < 0)
+    {
+       errmsg = e_argument_must_be_positive;
+       p_mhi = 0;
+    }
+    else if (p_mhi > 10000)
+    {
+       errmsg = e_invalid_argument;
+       p_mhi = 10000;
+    }
     if (p_re < 0 || p_re > 2)
     {
        errmsg = e_invalid_argument;
index d5f72a1ccd0983bbde7ef0b3b999084ceff2e113..18a7c2ad565f5ddb96b7bfe981c3e2098e6b92d9 100644 (file)
@@ -794,6 +794,7 @@ EXTERN int  p_mousemev;     // 'mousemoveevent'
 #endif
 EXTERN long    p_mouset;       // 'mousetime'
 EXTERN int     p_more;         // 'more'
+EXTERN long    p_mhi;          // 'msghistory'
 #ifdef FEAT_MZSCHEME
 EXTERN long    p_mzq;          // 'mzquantum
 # if defined(DYNAMIC_MZSCHEME)
index 585604fb31c925b79775f7c5ce3608ab5c585cf0..81bb1db4027ce63c45dbc69f69fccfd7ee1c409d 100644 (file)
@@ -1778,6 +1778,9 @@ static struct vimoption options[] =
     {"mousetime",   "mouset",  P_NUM|P_VI_DEF,
                            (char_u *)&p_mouset, PV_NONE, NULL, NULL,
                            {(char_u *)500L, (char_u *)0L} SCTX_INIT},
+    {"msghistory","mhi",    P_NUM|P_VI_DEF,
+                           (char_u *)&p_mhi, PV_NONE, NULL, NULL,
+                           {(char_u *)500L, (char_u *)0L} SCTX_INIT},
     {"mzquantum",  "mzq",   P_NUM,
 #ifdef FEAT_MZSCHEME
                            (char_u *)&p_mzq, PV_NONE, did_set_mzquantum, NULL,
index afea28b7efe9c05639cbbea0bb264fe2972fc595..ac9401ecad4e2900654861d6545c0714c5dcc3a0 100644 (file)
@@ -85,6 +85,7 @@ let test_values = {
       \ 'imstyle': [[0, 1], [-1, 2, 999]],
       \ 'lines': [[2, 24, 1000], [-1, 0, 1]],
       \ 'linespace': [[-1, 0, 2, 4, 999], ['']],
+      \ 'msghistory': [[0, 1, 100, 10000], [-1, 10001]],
       \ 'numberwidth': [[1, 4, 8, 10, 11, 20], [-1, 0, 21]],
       \ 'regexpengine': [[0, 1, 2], [-1, 3, 999]],
       \ 'report': [[0, 1, 2, 9999], [-1]],
index bd9da730b38996145bf16df89e9b94701ec1490d..09a41f7dab88a02c02f0d8aa23259a3db745a831 100644 (file)
@@ -732,6 +732,7 @@ func Test_set_option_errors()
   call assert_fails('set backupcopy=', 'E474:')
   call assert_fails('set regexpengine=3', 'E474:')
   call assert_fails('set history=10001', 'E474:')
+  call assert_fails('set msghistory=10001', 'E474:')
   call assert_fails('set numberwidth=21', 'E474:')
   call assert_fails('set colorcolumn=-a', 'E474:')
   call assert_fails('set colorcolumn=a', 'E474:')
@@ -745,6 +746,7 @@ func Test_set_option_errors()
   endif
   call assert_fails('set helpheight=-1', 'E487:')
   call assert_fails('set history=-1', 'E487:')
+  call assert_fails('set msghistory=-1', 'E487:')
   call assert_fails('set report=-1', 'E487:')
   call assert_fails('set shiftwidth=-1', 'E487:')
   call assert_fails('set sidescroll=-1', 'E487:')
index d0aa4036a6c7af4c71fe15a5ee14fc28e220af81..cbc4a8e11b7ed1cc1a75aa77d61e0a191e60fad1 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    864,
 /**/
     863,
 /**/