• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisão27782797c331b8800c12ad17c5d05adab5e92edb (tree)
Hora2007-09-14 05:41:32
Autorvimboss
Commitervimboss

Mensagem de Log

updated for version 7.1-107

Mudança Sumário

Diff

diff -r c17ba3fb433e -r 27782797c331 src/ops.c
--- a/src/ops.c Thu Sep 13 20:05:18 2007 +0000
+++ b/src/ops.c Thu Sep 13 20:41:32 2007 +0000
@@ -2477,7 +2477,7 @@
24772477
24782478 /*
24792479 * Spaces and tabs in the indent may have changed to other spaces and
2480- * tabs. Get the starting column again and correct the lenght.
2480+ * tabs. Get the starting column again and correct the length.
24812481 * Don't do this when "$" used, end-of-line will have changed.
24822482 */
24832483 block_prep(oap, &bd2, oap->start.lnum, TRUE);
@@ -2534,7 +2534,9 @@
25342534 #ifdef FEAT_VISUALEXTRA
25352535 long offset;
25362536 linenr_T linenr;
2537- long ins_len, pre_textlen = 0;
2537+ long ins_len;
2538+ long pre_textlen = 0;
2539+ long pre_indent = 0;
25382540 char_u *firstline;
25392541 char_u *ins_text, *newp, *oldp;
25402542 struct block_def bd;
@@ -2579,7 +2581,9 @@
25792581 || gchar_cursor() == NUL))
25802582 coladvance_force(getviscol());
25812583 # endif
2582- pre_textlen = (long)STRLEN(ml_get(oap->start.lnum));
2584+ firstline = ml_get(oap->start.lnum);
2585+ pre_textlen = (long)STRLEN(firstline);
2586+ pre_indent = (long)(skipwhite(firstline) - firstline);
25832587 bd.textcol = curwin->w_cursor.col;
25842588 }
25852589 #endif
@@ -2598,13 +2602,22 @@
25982602 */
25992603 if (oap->block_mode && oap->start.lnum != oap->end.lnum)
26002604 {
2605+ /* Auto-indenting may have changed the indent. If the cursor was past
2606+ * the indent, exclude that indent change from the inserted text. */
26012607 firstline = ml_get(oap->start.lnum);
2602- /*
2603- * Subsequent calls to ml_get() flush the firstline data - take a
2604- * copy of the required bit.
2605- */
2606- if ((ins_len = (long)STRLEN(firstline) - pre_textlen) > 0)
2608+ if (bd.textcol > pre_indent)
26072609 {
2610+ long new_indent = (long)(skipwhite(firstline) - firstline);
2611+
2612+ pre_textlen += new_indent - pre_indent;
2613+ bd.textcol += new_indent - pre_indent;
2614+ }
2615+
2616+ ins_len = (long)STRLEN(firstline) - pre_textlen;
2617+ if (ins_len > 0)
2618+ {
2619+ /* Subsequent calls to ml_get() flush the firstline data - take a
2620+ * copy of the inserted text. */
26082621 if ((ins_text = alloc_check((unsigned)(ins_len + 1))) != NULL)
26092622 {
26102623 vim_strncpy(ins_text, firstline + bd.textcol, (size_t)ins_len);
diff -r c17ba3fb433e -r 27782797c331 src/version.c
--- a/src/version.c Thu Sep 13 20:05:18 2007 +0000
+++ b/src/version.c Thu Sep 13 20:41:32 2007 +0000
@@ -667,6 +667,8 @@
667667 static int included_patches[] =
668668 { /* Add new patch number below this line */
669669 /**/
670+ 107,
671+/**/
670672 106,
671673 /**/
672674 105,
Show on old repository browser