]> granicus.if.org Git - vim/commitdiff
patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete" v8.1.1746
authorBram Moolenaar <Bram@vim.org>
Wed, 24 Jul 2019 20:30:27 +0000 (22:30 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 24 Jul 2019 20:30:27 +0000 (22:30 +0200)
Problem:    ":dl" is seen as ":dlist" instead of ":delete".
Solution:   Do not use cmdidxs2[] if the length is 1. (closes #4721)

src/ex_docmd.c
src/testdir/Make_all.mak
src/testdir/test_excmd.vim [new file with mode: 0644]
src/version.c

index 3fa5129c78e06de2c3c39370c3f1ae4b12c6c0f1..f3a4eb7c1b66afa5ebd266c11e00ceadedb07259 100644 (file)
@@ -3191,7 +3191,7 @@ find_command(exarg_T *eap, int *full UNUSED)
        if (ASCII_ISLOWER(eap->cmd[0]))
        {
            int c1 = eap->cmd[0];
-           int c2 = eap->cmd[1];
+           int c2 = len == 1 ? NUL : eap->cmd[1];
 
            if (command_count != (int)CMD_SIZE)
            {
index eb014a95c2cdb2beef5532f0a73d5fad321cda5e..a0898dc02a894762299b7a5b9cf997bb5e539752 100644 (file)
@@ -106,6 +106,7 @@ NEW_TESTS = \
        test_ex_equal \
        test_ex_undo \
        test_ex_z \
+       test_excmd \
        test_exec_while_if \
        test_execute_func \
        test_exists \
@@ -328,6 +329,7 @@ NEW_TESTS_RES = \
        test_erasebackword.res \
        test_escaped_glob.res \
        test_eval_stuff.res \
+       test_excmd.res \
        test_exec_while_if.res \
        test_exists.res \
        test_exists_autocmd.res \
diff --git a/src/testdir/test_excmd.vim b/src/testdir/test_excmd.vim
new file mode 100644 (file)
index 0000000..f5ce979
--- /dev/null
@@ -0,0 +1,10 @@
+" Tests for various Ex commands.
+
+func Test_ex_delete()
+  new
+  call setline(1, ['a', 'b', 'c'])
+  2
+  " :dl is :delete with the "l" flag, not :dlist
+  .dl
+  call assert_equal(['a', 'c'], getline(1, 2))
+endfunc
index e155b39d094cb3929b341293d04f9bc031cbb595..4f9bebac0d7ff564f98531a31ff376aa4ad24794 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1746,
 /**/
     1745,
 /**/