From f3fa6507f2473d66a4c6172c82dec43bf55f8df6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 8 Dec 2024 07:00:17 +0800 Subject: [PATCH] vim-patch:9.1.0910: 'messagesopt' does not check max wait time Problem: 'messagesopt' does not check max wait time (after v9.1.0908) Solution: Check for max wait value (Shougo Matsushita) closes: vim/vim#16183 https://github.com/vim/vim/commit/d9e9f89e0ffd6e7ce5e2a7f8f1ace5471e37c210 Co-authored-by: Shougo Matsushita --- runtime/doc/options.txt | 1 + runtime/lua/vim/_meta/options.lua | 1 + src/nvim/message.c | 5 +++++ src/nvim/options.lua | 1 + test/old/testdir/gen_opt_test.vim | 3 ++- 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 0db7b0f03c..7899f40e24 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4059,6 +4059,7 @@ A jump table for the options with a short description can be found at |Q_op|. milliseconds so the user has a chance to read the message, use 0 to disable sleep (but then the user may miss an important message). + The maximum value is 10000. history:{n} Determines how many entries are remembered in the |:messages| history. The maximum value is 10000. diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 59d270e640..e38fa4a89f 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -4095,6 +4095,7 @@ vim.go.mis = vim.go.menuitems --- milliseconds so the user has a chance to read the --- message, use 0 to disable sleep (but then the user may --- miss an important message). +--- The maximum value is 10000. --- --- history:{n} Determines how many entries are remembered in the --- `:messages` history. The maximum value is 10000. diff --git a/src/nvim/message.c b/src/nvim/message.c index a32a06edca..f6424c4644 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1103,6 +1103,11 @@ int messagesopt_changed(void) return FAIL; } + // "wait" must be <= 10000 + if (messages_wait_new > 10000) { + return FAIL; + } + msg_flags = messages_flags_new; msg_wait = messages_wait_new; diff --git a/src/nvim/options.lua b/src/nvim/options.lua index a5d5a45b59..e08f3d1410 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -5467,6 +5467,7 @@ return { milliseconds so the user has a chance to read the message, use 0 to disable sleep (but then the user may miss an important message). + The maximum value is 10000. history:{n} Determines how many entries are remembered in the |:messages| history. The maximum value is 10000. diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index 74aea93ee9..22ffde5269 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -267,7 +267,8 @@ let test_values = { \ 'history:100,wait:100', 'history:0,wait:0', \ 'hit-enter,history:1,wait:1'], \ ['xxx', 'history:500', 'hit-enter,history:-1', - \ 'hit-enter,history:10001', 'hit-enter']], + \ 'hit-enter,history:10001', 'history:0,wait:10001', + \ 'hit-enter']], \ 'mkspellmem': [['10000,100,12'], ['', 'xxx', '10000,100']], \ 'mouse': [['', 'n', 'v', 'i', 'c', 'h', 'a', 'r', 'nvi'], \ ['xxx', 'n,v,i']],