Skip to content

Commit 4bd9b2b

Browse files
ShougoMilly
authored andcommitted
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>
1 parent de094dc commit 4bd9b2b

13 files changed

Lines changed: 36 additions & 10 deletions

File tree

runtime/doc/message.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*message.txt* For Vim version 9.1. Last change: 2024 Mar 13
1+
*message.txt* For Vim version 9.1. Last change: 2024 Nov 14
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -29,7 +29,7 @@ depends on the 'shortmess' option.
2929
Clear messages, keeping only the {count} most
3030
recent ones.
3131

32-
The number of remembered messages is fixed at 200.
32+
The number of remembered messages is determined by the 'msghistory' option.
3333

3434
*g<*
3535
The "g<" command can be used to see the last page of previous command output.

runtime/doc/options.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4440,7 +4440,8 @@ A jump table for the options with a short description can be found at |Q_op|.
44404440
global
44414441
A history of ":" commands, and a history of previous search patterns
44424442
is remembered. This option decides how many entries may be stored in
4443-
each of these histories (see |cmdline-editing|).
4443+
each of these histories (see |cmdline-editing| and 'msghistory' for
4444+
the number of messages to remember).
44444445
The maximum value is 10000.
44454446
NOTE: This option is set to the Vi default value when 'compatible' is
44464447
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|.
59175918
time in msec between two mouse clicks for the second click to be
59185919
recognized as a multi click.
59195920

5921+
*'msghistory'* *'mhi'*
5922+
'msghistory' 'mhi' number (default 500)
5923+
global
5924+
Determines how many entries are remembered in the |:messages| history.
5925+
The maximum value is 10000.
5926+
59205927
*'mzquantum'* *'mzq'*
59215928
'mzquantum' 'mzq' number (default 100)
59225929
global

runtime/doc/tags

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ $quote eval.txt /*$quote*
501501
'mesg' vi_diff.txt /*'mesg'*
502502
'mfd' options.txt /*'mfd'*
503503
'mh' options.txt /*'mh'*
504+
'mhi' options.txt /*'mhi'*
504505
'mis' options.txt /*'mis'*
505506
'mkspellmem' options.txt /*'mkspellmem'*
506507
'ml' options.txt /*'ml'*
@@ -531,6 +532,7 @@ $quote eval.txt /*$quote*
531532
'mousetime' options.txt /*'mousetime'*
532533
'mp' options.txt /*'mp'*
533534
'mps' options.txt /*'mps'*
535+
'msghistory' options.txt /*'msghistory'*
534536
'msm' options.txt /*'msm'*
535537
'mzq' options.txt /*'mzq'*
536538
'mzquantum' options.txt /*'mzquantum'*

runtime/doc/version9.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*version9.txt* For Vim version 9.1. Last change: 2024 Nov 11
1+
*version9.txt* For Vim version 9.1. Last change: 2024 Nov 14
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -41659,6 +41659,7 @@ Options: ~
4165941659
popup
4166041660
'findfunc' Vim function to obtain the results for a |:find|
4166141661
command
41662+
'msghistory' Max number of messages to remember
4166241663
'winfixbuf' Keep buffer focused in a window
4166341664
'tabclose' Which tab page to focus after closing a tab page
4166441665
't_xo' Terminal uses XON/XOFF handshaking (e.g. vt420)

runtime/optwin.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,8 @@ call <SID>AddOption("terse", gettext("add 's' flag in 'shortmess' (don't show se
749749
call <SID>BinOptionG("terse", &terse)
750750
call <SID>AddOption("shortmess", gettext("list of flags to make messages shorter"))
751751
call <SID>OptionG("shm", &shm)
752+
call <SID>AddOption("msghistory", gettext("how many messages are remembered"))
753+
call append("$", " \tset mhi=" . &mhi)
752754
call <SID>AddOption("showcmd", gettext("show (partial) command keys in location given by 'showcmdloc'"))
753755
let &sc = s:old_sc
754756
call <SID>BinOptionG("sc", &sc)

src/feature.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,6 @@
137137
* main window area.
138138
*/
139139

140-
/*
141-
* Message history is fixed at 200 messages.
142-
*/
143-
#define MAX_MSG_HIST_LEN 200
144-
145140
/*
146141
* +folding Fold lines.
147142
*/

src/message.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ add_msg_hist(
10131013
return;
10141014

10151015
// Don't let the message history get too big
1016-
while (msg_hist_len > MAX_MSG_HIST_LEN)
1016+
while (msg_hist_len > p_mhi)
10171017
(void)delete_first_msg();
10181018

10191019
// allocate an entry and add the message at the end of the history

src/option.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4914,6 +4914,16 @@ check_num_option_bounds(
49144914
errmsg = e_invalid_argument;
49154915
p_hi = 10000;
49164916
}
4917+
if (p_mhi < 0)
4918+
{
4919+
errmsg = e_argument_must_be_positive;
4920+
p_mhi = 0;
4921+
}
4922+
else if (p_mhi > 10000)
4923+
{
4924+
errmsg = e_invalid_argument;
4925+
p_mhi = 10000;
4926+
}
49174927
if (p_re < 0 || p_re > 2)
49184928
{
49194929
errmsg = e_invalid_argument;

src/option.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ EXTERN int p_mousemev; // 'mousemoveevent'
794794
#endif
795795
EXTERN long p_mouset; // 'mousetime'
796796
EXTERN int p_more; // 'more'
797+
EXTERN long p_mhi; // 'msghistory'
797798
#ifdef FEAT_MZSCHEME
798799
EXTERN long p_mzq; // 'mzquantum
799800
# if defined(DYNAMIC_MZSCHEME)

src/optiondefs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,6 +1778,9 @@ static struct vimoption options[] =
17781778
{"mousetime", "mouset", P_NUM|P_VI_DEF,
17791779
(char_u *)&p_mouset, PV_NONE, NULL, NULL,
17801780
{(char_u *)500L, (char_u *)0L} SCTX_INIT},
1781+
{"msghistory","mhi", P_NUM|P_VI_DEF,
1782+
(char_u *)&p_mhi, PV_NONE, NULL, NULL,
1783+
{(char_u *)500L, (char_u *)0L} SCTX_INIT},
17811784
{"mzquantum", "mzq", P_NUM,
17821785
#ifdef FEAT_MZSCHEME
17831786
(char_u *)&p_mzq, PV_NONE, did_set_mzquantum, NULL,

0 commit comments

Comments
 (0)