summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2007-09-13 20:41:32 +0000
committerBram Moolenaar <Bram@vim.org>2007-09-13 20:41:32 +0000
commit53241daeba2eaca436cb9356f590ee8209f86a81 (patch)
treee1bc537736c1100f140bf1667c990f3981fe6409
parent5c2e0f27c5fb2832326f2285b6e61d8e72705164 (diff)
downloadvim-git-53241daeba2eaca436cb9356f590ee8209f86a81.tar.gz
updated for version 7.1-107v7.1.107
-rw-r--r--src/ops.c29
-rw-r--r--src/version.c2
2 files changed, 23 insertions, 8 deletions
diff --git a/src/ops.c b/src/ops.c
index e8c69170f..29fac4cd4 100644
--- 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);
diff --git a/src/version.c b/src/version.c
index b319fcc0b..097284a9b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -667,6 +667,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 107,
+/**/
106,
/**/
105,