]> granicus.if.org Git - vim/commitdiff
updated for version 7.1-107 v7.1.107
authorBram Moolenaar <Bram@vim.org>
Thu, 13 Sep 2007 20:41:32 +0000 (20:41 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 13 Sep 2007 20:41:32 +0000 (20:41 +0000)
src/ops.c
src/version.c

index e8c69170f8bcc3972e964ffb5ea7bad9cb956917..29fac4cd4f165e5e5fcc5e22b22e6118279811db 100644 (file)
--- a/src/ops.c
+++ b/src/ops.c
@@ -2477,7 +2477,7 @@ op_insert(oap, count1)
 
        /*
         * Spaces and tabs in the indent may have changed to other spaces and
-        * tabs.  Get the starting column again and correct the lenght.
+        * tabs.  Get the starting column again and correct the length.
         * Don't do this when "$" used, end-of-line will have changed.
         */
        block_prep(oap, &bd2, oap->start.lnum, TRUE);
@@ -2534,7 +2534,9 @@ op_change(oap)
 #ifdef FEAT_VISUALEXTRA
     long               offset;
     linenr_T           linenr;
-    long               ins_len, pre_textlen = 0;
+    long               ins_len;
+    long               pre_textlen = 0;
+    long               pre_indent = 0;
     char_u             *firstline;
     char_u             *ins_text, *newp, *oldp;
     struct block_def   bd;
@@ -2579,7 +2581,9 @@ op_change(oap)
                                                    || gchar_cursor() == NUL))
            coladvance_force(getviscol());
 # endif
-       pre_textlen = (long)STRLEN(ml_get(oap->start.lnum));
+       firstline = ml_get(oap->start.lnum);
+       pre_textlen = (long)STRLEN(firstline);
+       pre_indent = (long)(skipwhite(firstline) - firstline);
        bd.textcol = curwin->w_cursor.col;
     }
 #endif
@@ -2598,13 +2602,22 @@ op_change(oap)
      */
     if (oap->block_mode && oap->start.lnum != oap->end.lnum)
     {
+       /* Auto-indenting may have changed the indent.  If the cursor was past
+        * the indent, exclude that indent change from the inserted text. */
        firstline = ml_get(oap->start.lnum);
-       /*
-        * Subsequent calls to ml_get() flush the firstline data - take a
-        * copy of the required bit.
-        */
-       if ((ins_len = (long)STRLEN(firstline) - pre_textlen) > 0)
+       if (bd.textcol > pre_indent)
+       {
+           long new_indent = (long)(skipwhite(firstline) - firstline);
+
+           pre_textlen += new_indent - pre_indent;
+           bd.textcol += new_indent - pre_indent;
+       }
+
+       ins_len = (long)STRLEN(firstline) - pre_textlen;
+       if (ins_len > 0)
        {
+           /* Subsequent calls to ml_get() flush the firstline data - take a
+            * copy of the inserted text.  */
            if ((ins_text = alloc_check((unsigned)(ins_len + 1))) != NULL)
            {
                vim_strncpy(ins_text, firstline + bd.textcol, (size_t)ins_len);
index b319fcc0b8128dc22137abf0ac0cd9fe60d91142..097284a9bcb2a954e523fbfe10cc8c65bf104e72 100644 (file)
@@ -666,6 +666,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    107,
 /**/
     106,
 /**/