changeset 21941:f65e76638eb5 v8.2.1520

patch 8.2.1520: Vim9: CTRL-] used in :def function does not work Commit: https://github.com/vim/vim/commit/b3ea36c5bcb88b6a05a66347eedd461e9385103f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 23 21:46:32 2020 +0200 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work Problem: Vim9: CTRL-] used in :def function does not work. Solution: Omit count or prepend colon. (closes https://github.com/vim/vim/issues/6769)
author Bram Moolenaar <Bram@vim.org>
date Sun, 23 Aug 2020 22:00:04 +0200
parents fa1bcfaa7897
children 8d0dec0cc0b8
files src/normal.c src/testdir/test_vim9_cmd.vim src/version.c
diffstat 3 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/normal.c
+++ b/src/normal.c
@@ -3644,8 +3644,10 @@ nv_ident(cmdarg_T *cap)
 	    {
 		if (g_cmd)
 		    STRCPY(buf, "tj ");
+		else if (cap->count0 == 0)
+		    STRCPY(buf, "ta ");
 		else
-		    sprintf((char *)buf, "%ldta ", cap->count0);
+		    sprintf((char *)buf, ":%ldta ", cap->count0);
 	    }
     }
 
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -295,5 +295,25 @@ def Test_map_command()
   CheckScriptSuccess(['vim9script'] + lines)
 enddef
 
+def Test_normal_command()
+  new
+  setline(1, 'doesnotexist')
+  let caught = 0
+  try
+    exe "norm! \<C-]>"
+  catch /E433/
+    caught = 2
+  endtry
+  assert_equal(2, caught)
+
+  try
+    exe "norm! 3\<C-]>"
+  catch /E433/
+    caught = 3
+  endtry
+  assert_equal(3, caught)
+  bwipe!
+enddef
+
 
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1520,
+/**/
     1519,
 /**/
     1518,