patch 9.1.0752: can set 'cedit' to an invalid value
Commit:
https://github.com/vim/vim/commit/25732435c56d762abb260499680939bd8882c708
Author: Milly <[email protected]>
Date: Tue Oct 1 19:30:20 2024 +0200
patch 9.1.0752: can set 'cedit' to an invalid value
Problem: can set cedit to an invalid value
Solution: Check that the value is a valid key name
(Milly)
closes: #15778
Signed-off-by: Milly <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 94671d17c..49087d373 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 9.1. Last change: 2024 Sep 26
+*options.txt* For Vim version 9.1. Last change: 2024 Oct 01
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1651,9 +1651,10 @@ A jump table for the options with a short description
can be found at |Q_op|.
The default is CTRL-F when 'compatible' is off.
Only non-printable keys are allowed.
The key can be specified as a single character, but it is difficult to
- type. The preferred way is to use the <> notation. Examples: >
- :exe "set cedit=\<C-Y>"
- :exe "set cedit=\<Esc>"
+ type. The preferred way is to use |key-notation| (e.g. <Up>, <C-F>) or
+ a letter preceded with a caret (e.g. `^F` is CTRL-F). Examples: >
+ :set cedit=^Y
+ :set cedit=<Esc>
< |Nvi| also has this option, but it only uses the first character.
See |cmdwin|.
NOTE: This option is set to the Vim default value when 'compatible'
diff --git a/src/ex_getln.c b/src/ex_getln.c
index ef7ca9186..9d0695a96 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4445,7 +4445,7 @@ did_set_cedit(optset_T *args UNUSED)
else
{
n = string_to_key(p_cedit, FALSE);
- if (vim_isprintc(n))
+ if (n == 0 || vim_isprintc(n))
return e_invalid_argument;
cedit_key = n;
}
diff --git a/src/testdir/gen_opt_test.vim b/src/testdir/gen_opt_test.vim
index 767471483..c601158c2 100644
--- a/src/testdir/gen_opt_test.vim
+++ b/src/testdir/gen_opt_test.vim
@@ -72,7 +72,7 @@ let test_values = {
\ 'bufhidden': [['', 'hide', 'wipe'], ['xxx', 'hide,wipe']],
\ 'buftype': [['', 'help', 'nofile'], ['xxx', 'help,nofile']],
\ 'casemap': [['', 'internal'], ['xxx']],
- \ 'cedit': [['', '\<Esc>'], ['xxx', 'f']],
+ \ 'cedit': [['', '^Y', '<Esc>'], ['xxx', 'f', '<xxx>']],
\ 'clipboard': [['', 'unnamed', 'autoselect,unnamed', 'html',
'exclude:vimdisplay'], ['xxx', '\ze*', 'exclude:\%(']],
\ 'colorcolumn': [['', '8', '+2'], ['xxx']],
\ 'comments': [['', 'b:#'], ['xxx']],
diff --git a/src/version.c b/src/version.c
index c6651c720..37435658f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 752,
/**/
751,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1svgvp-004lRj-2v%40256bit.org.