Skip to content

Commit

Permalink
patch 9.1.0752: can set 'cedit' to an invalid value
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Milly authored and chrisbra committed Oct 1, 2024
1 parent baee844 commit 2573243
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
9 changes: 5 additions & 4 deletions runtime/doc/options.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/ex_getln.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/testdir/gen_opt_test.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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']],
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
752,
/**/
751,
/**/
Expand Down

0 comments on commit 2573243

Please sign in to comment.