]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.034 v7.4.034
authorBram Moolenaar <Bram@vim.org>
Sun, 22 Sep 2013 13:23:44 +0000 (15:23 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 22 Sep 2013 13:23:44 +0000 (15:23 +0200)
Problem:    Using "p" in Visual block mode only changes the first line.
Solution:   Repeat the put in all text in the block. (Christian Brabandt)

runtime/doc/change.txt
src/normal.c
src/ops.c
src/testdir/test20.in
src/testdir/test20.ok
src/version.c

index 96a9c8b4a7b344a87529335ef34c7d3c8bb3590d..77c791ed56119dba483378e0b056e532226ae1fd 100644 (file)
@@ -1069,6 +1069,11 @@ another register.  E.g., yank the text to copy, Visually select the text to
 replace and use "0p .  You can repeat this as many times as you like, the
 unnamed register will be changed each time.
 
+When you use a blockwise Visual mode command and yank only a single line into
+a register, a paste on a visual selected area will paste that single line on
+each of the selected lines (thus replacing the blockwise selected region by a
+block of the pasted line).
+
                                                        *blockwise-register*
 If you use a blockwise Visual mode command to get the text into the register,
 the block of text will be inserted before ("P") or after ("p") the cursor
index 80ada682edcbf368605cd99b6b65a69aa2c5fe60..4c11a2b6072d233383793ba00fac9af943f6e734 100644 (file)
@@ -9518,6 +9518,8 @@ nv_put(cap)
                /* cursor is at the end of the line or end of file, put
                 * forward. */
                dir = FORWARD;
+           /* May have been reset in do_put(). */
+           VIsual_active = TRUE;
        }
 #endif
        do_put(cap->oap->regname, dir, cap->count1, flags);
index 3989802d38ee442a20163d6317fc06bfbeb4fd84..db5a182c19673c62055f31d106b68fbf9e10b040 100644 (file)
--- a/src/ops.c
+++ b/src/ops.c
@@ -3776,25 +3776,42 @@ do_put(regname, dir, count, flags)
         */
        if (y_type == MCHAR && y_size == 1)
        {
-           totlen = count * yanklen;
-           if (totlen)
-           {
-               oldp = ml_get(lnum);
-               newp = alloc_check((unsigned)(STRLEN(oldp) + totlen + 1));
-               if (newp == NULL)
-                   goto end;           /* alloc() will give error message */
-               mch_memmove(newp, oldp, (size_t)col);
-               ptr = newp + col;
-               for (i = 0; i < count; ++i)
+           do {
+               totlen = count * yanklen;
+               if (totlen > 0)
                {
-                   mch_memmove(ptr, y_array[0], (size_t)yanklen);
-                   ptr += yanklen;
+                   oldp = ml_get(lnum);
+                   newp = alloc_check((unsigned)(STRLEN(oldp) + totlen + 1));
+                   if (newp == NULL)
+                       goto end;       /* alloc() gave an error message */
+                   mch_memmove(newp, oldp, (size_t)col);
+                   ptr = newp + col;
+                   for (i = 0; i < count; ++i)
+                   {
+                       mch_memmove(ptr, y_array[0], (size_t)yanklen);
+                       ptr += yanklen;
+                   }
+                   STRMOVE(ptr, oldp + col);
+                   ml_replace(lnum, newp, FALSE);
+                   /* Place cursor on last putted char. */
+                   if (lnum == curwin->w_cursor.lnum)
+                       curwin->w_cursor.col += (colnr_T)(totlen - 1);
                }
-               STRMOVE(ptr, oldp + col);
-               ml_replace(lnum, newp, FALSE);
-               /* Put cursor on last putted char. */
-               curwin->w_cursor.col += (colnr_T)(totlen - 1);
-           }
+#ifdef FEAT_VISUAL
+               if (VIsual_active)
+                   lnum++;
+#endif
+           } while (
+#ifdef FEAT_VISUAL
+                   VIsual_active && lnum <= curbuf->b_visual.vi_end.lnum
+#else
+                   FALSE /* stop after 1 paste */
+#endif
+                   );
+#ifdef FEAT_VISUAL
+           VIsual_active = FALSE;
+#endif
+
            curbuf->b_op_end = curwin->w_cursor;
            /* For "CTRL-O p" in Insert mode, put cursor after last char */
            if (totlen && (restart_edit != 0 || (flags & PUT_CURSEND)))
index 7201c75c2133d560b70ab09e968fb9917e02357a..662a1439f22471515f58f5a08372176e9b9edc6e 100644 (file)
@@ -9,11 +9,17 @@ G0"ay$k@au
 @auY:quit!
 GP
 /start here$
-\16jjlld
-:/here$/,$-1w! test.out
+"by$\16jjlld
+/456$
+\16jj"bP
+:/56$/,$-1w! test.out
 :qa!
 ENDTEST
 
+123456
+234567
+345678
+
 test text test tex start here
                some text
                test text
index 2604e7cc8e4661652e95d713c6b8bb4febd9cc67..7c50ea8db875d532f91ebdf2e39978f8b36f6519 100644 (file)
@@ -1,3 +1,7 @@
+123start here56
+234start here67
+345start here78
+
 test text test tex rt here
                somext
                tesext
index fc1880b906827e8dba72c9c5d6337460ca3f57a3..ab6c3c17c03250107ef01694055d371944e1d02c 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    34,
 /**/
     33,
 /**/