]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0752: can set 'cedit' to an invalid value v9.1.0752
authorMilly <milly.ca@gmail.com>
Tue, 1 Oct 2024 17:30:20 +0000 (19:30 +0200)
committerChristian Brabandt <cb@256bit.org>
Tue, 1 Oct 2024 17:33:39 +0000 (19:33 +0200)
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 <milly.ca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/options.txt
src/ex_getln.c
src/testdir/gen_opt_test.vim
src/version.c

index 94671d17cb3baec8c6554b396917663fb62d461f..49087d37324cc80b36b227517c2b6a3229c7434f 100644 (file)
@@ -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'
index ef7ca9186dd03bb0ce8865143e3c04d3de52990c..9d0695a9661fe4a3b4c7a5dbebace1517597d8a1 100644 (file)
@@ -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;
     }
index 767471483701a1425831e49da75141411664bfc2..c601158c230b54b7215662b56a12659a846814ed 100644 (file)
@@ -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']],
index c6651c720caf13ae8f6d2969f3113afa2cbab36c..37435658fec0520751c3caecf2d0468252a351a3 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    752,
 /**/
     751,
 /**/