changeset 23031:b68313ee7002 v8.2.2062

patch 8.2.2062: <Cmd> does not handle CTRL-V Commit: https://github.com/vim/vim/commit/4a44120e3dc1d40dd7109658afd5e078360b1d8f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 28 14:43:26 2020 +0100 patch 8.2.2062: <Cmd> does not handle CTRL-V Problem: <Cmd> does not handle CTRL-V. Solution: Call get_literal() after encountering CTRL-V. (closes https://github.com/vim/vim/issues/7387)
author Bram Moolenaar <Bram@vim.org>
date Sat, 28 Nov 2020 14:45:04 +0100
parents ec69d87aba97
children 52326852b941
files src/getchar.c src/testdir/test_mapping.vim src/version.c
diffstat 3 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -3675,6 +3675,14 @@ getcmdkeycmd(
 	    }
 	    c1 = TO_SPECIAL(c1, c2);
 	}
+	if (c1 == Ctrl_V)
+	{
+	    // CTRL-V is followed by octal, hex or other characters, reverses
+	    // what AppendToRedobuffLit() does.
+	    no_reduce_keys = TRUE;  //  don't merge modifyOtherKeys
+	    c1 = get_literal();
+	    no_reduce_keys = FALSE;
+	}
 
 	if (got_int)
 	    aborted = TRUE;
--- a/src/testdir/test_mapping.vim
+++ b/src/testdir/test_mapping.vim
@@ -972,6 +972,11 @@ func Test_map_cmdkey()
   unmap <F3>
   unmap! <F3>
   %bw!
+
+  " command line ending in "0" is handled without errors
+  onoremap ix <cmd>eval 0<cr>
+  call feedkeys('dix.', 'xt')
+  ounmap ix
 endfunc
 
 " text object enters visual mode
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2062,
+/**/
     2061,
 /**/
     2060,