diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-11-15 08:04:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-15 08:04:49 +0800 |
commit | fa0dcde3d9f17f85baa9dd41aa751c123281ced3 (patch) | |
tree | ef8336f8d67f8dfb363cf9d755be7871ada567ca /src | |
parent | 05d354e2165c2c331a33949d49095eef3503a32f (diff) | |
download | rneovim-fa0dcde3d9f17f85baa9dd41aa751c123281ced3.tar.gz rneovim-fa0dcde3d9f17f85baa9dd41aa751c123281ced3.tar.bz2 rneovim-fa0dcde3d9f17f85baa9dd41aa751c123281ced3.zip |
vim-patch:9.1.0864: message history is fixed to 200 (#31215)
Problem: message history is fixed to 200
Solution: Add the 'msghistory' option, increase the default
value to 500 (Shougo Matsushita)
closes: vim/vim#16048
https://github.com/vim/vim/commit/4bd9b2b2467e696061104a029000e9824c6c609e
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Co-authored-by: Milly <milly.ca@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/message.c | 2 | ||||
-rw-r--r-- | src/nvim/option.c | 7 | ||||
-rw-r--r-- | src/nvim/option_vars.h | 1 | ||||
-rw-r--r-- | src/nvim/options.lua | 16 | ||||
-rw-r--r-- | src/nvim/vim_defs.h | 1 |
5 files changed, 24 insertions, 3 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index e8ba2a9aeb..e8f20916b8 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -981,7 +981,7 @@ static void add_msg_hist_multihl(const char *s, int len, int hl_id, bool multili } // Don't let the message history get too big - while (msg_hist_len > MAX_MSG_HIST_LEN) { + while (msg_hist_len > p_mhi) { delete_first_msg(); } diff --git a/src/nvim/option.c b/src/nvim/option.c index 03b7c8cb14..efd52f9233 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2874,6 +2874,13 @@ static const char *validate_num_option(OptIndex opt_idx, OptInt *newval, char *e return e_invarg; } break; + case kOptMsghistory: + if (value < 0) { + return e_positive; + } else if (value > 10000) { + return e_invarg; + } + break; case kOptPyxversion: if (value == 0) { *newval = 3; diff --git a/src/nvim/option_vars.h b/src/nvim/option_vars.h index a60bd047c1..e0a972f06c 100644 --- a/src/nvim/option_vars.h +++ b/src/nvim/option_vars.h @@ -536,6 +536,7 @@ EXTERN OptInt p_mousescroll_vert INIT( = MOUSESCROLL_VERT_DFLT); EXTERN OptInt p_mousescroll_hor INIT( = MOUSESCROLL_HOR_DFLT); EXTERN OptInt p_mouset; ///< 'mousetime' EXTERN int p_more; ///< 'more' +EXTERN OptInt p_mhi; ///< 'msghistory' EXTERN char *p_nf; ///< 'nrformats' EXTERN char *p_opfunc; ///< 'operatorfunc' EXTERN char *p_para; ///< 'paragraphs' diff --git a/src/nvim/options.lua b/src/nvim/options.lua index e648d4350a..6fab0621f9 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -3962,7 +3962,8 @@ return { desc = [=[ 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. ]=], full_name = 'history', @@ -5758,6 +5759,19 @@ return { varname = 'p_mouset', }, { + abbreviation = 'mhi', + defaults = { if_true = 500 }, + desc = [=[ + Determines how many entries are remembered in the |:messages| history. + The maximum value is 10000. + ]=], + full_name = 'msghistory', + scope = { 'global' }, + short_desc = N_('how many messages are remembered'), + type = 'number', + varname = 'p_mhi', + }, + { abbreviation = 'nf', cb = 'did_set_nrformats', defaults = { if_true = 'bin,hex' }, diff --git a/src/nvim/vim_defs.h b/src/nvim/vim_defs.h index f6b348e009..72aaa77533 100644 --- a/src/nvim/vim_defs.h +++ b/src/nvim/vim_defs.h @@ -2,7 +2,6 @@ // Some defines from the old feature.h #define SESSION_FILE "Session.vim" -#define MAX_MSG_HIST_LEN 200 #define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim" #define RUNTIME_DIRNAME "runtime" |