]> granicus.if.org Git - vim/commitdiff
patch 8.2.2189: cannot repeat a command that uses the small delete register v8.2.2189
authorBram Moolenaar <Bram@vim.org>
Tue, 22 Dec 2020 16:59:35 +0000 (17:59 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 22 Dec 2020 16:59:35 +0000 (17:59 +0100)
Problem:    Cannot repeat a command that uses the small delete register.
Solution:   Store the register name instead of the contents. (Christian
            Brabandt, closes #7527)

src/ops.c
src/register.c
src/testdir/test_registers.vim
src/version.c

index 53bd084ec026414cc76c5fe5a2ef65a29c0a55b8..d8e96ff1a46ad407a8919e9f1ced12632d62b2b6 100644 (file)
--- a/src/ops.c
+++ b/src/ops.c
@@ -9,7 +9,7 @@
 
 /*
  * ops.c: implementation of various operators: op_shift, op_delete, op_tilde,
- *       op_change, op_yank, do_put, do_join
+ *       op_change, op_yank, do_join
  */
 
 #include "vim.h"
index 6574432bdbecfd8683b09b6b5957208c498b3a34..56b6cadecd9856af26cb541b16568c52f7b62ba0 100644 (file)
@@ -809,7 +809,14 @@ insert_reg(
        {
            for (i = 0; i < y_current->y_size; ++i)
            {
-               stuffescaped(y_current->y_array[i], literally);
+               if (regname == '-')
+               {
+                   AppendCharToRedobuff(Ctrl_R);
+                   AppendCharToRedobuff(regname);
+                   do_put(regname, NULL, BACKWARD, 1L, PUT_CURSEND);
+               }
+               else
+                   stuffescaped(y_current->y_array[i], literally);
                // Insert a newline between lines and after last line if
                // y_type is MLINE.
                if (y_current->y_type == MLINE || i < y_current->y_size - 1)
index 521f8ad356fa96b235260341812f2067f3aeb2de..14febad70249e69cb20f615c80d55ebf78eccf9f 100644 (file)
@@ -698,4 +698,15 @@ func Test_ve_blockpaste()
   bwipe!
 endfunc
 
+func Test_insert_small_delete()
+  new
+  call setline(1, ['foo foobar bar'])
+  call cursor(1,1)
+  exe ":norm! ciw'\<C-R>-'"
+  call assert_equal(getline(1), "'foo' foobar bar")
+  exe ":norm! w.w."
+  call assert_equal(getline(1), "'foo' 'foobar' 'bar'")
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index d6eaf8d7ea47306caf08c27fd3b97d9b48bcdd60..65dfcdfaefb800094def7831d2dc27647687ca51 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2189,
 /**/
     2188,
 /**/