]> git.pld-linux.org Git - packages/vim.git/blob - 7.1.107
- updated to 7.1.285
[packages/vim.git] / 7.1.107
1 To: vim-dev@vim.org
2 Subject: patch 7.1.107
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.1.107
11 Problem:    When doing a block selection and using "s" to change the text,
12             while triggering auto-indenting, causes the wrong text to be
13             repeated in other lines. (Adri Verhoef)
14 Solution:   Compute the change of indent and compensate for that.
15 Files:      src/ops.c
16
17
18 *** ../vim-7.1.106/src/ops.c    Thu Jun 28 22:14:28 2007
19 --- src/ops.c   Thu Aug 30 11:41:10 2007
20 ***************
21 *** 2477,2483 ****
22   
23         /*
24          * Spaces and tabs in the indent may have changed to other spaces and
25 !        * tabs.  Get the starting column again and correct the lenght.
26          * Don't do this when "$" used, end-of-line will have changed.
27          */
28         block_prep(oap, &bd2, oap->start.lnum, TRUE);
29 --- 2477,2483 ----
30   
31         /*
32          * Spaces and tabs in the indent may have changed to other spaces and
33 !        * tabs.  Get the starting column again and correct the length.
34          * Don't do this when "$" used, end-of-line will have changed.
35          */
36         block_prep(oap, &bd2, oap->start.lnum, TRUE);
37 ***************
38 *** 2534,2540 ****
39   #ifdef FEAT_VISUALEXTRA
40       long              offset;
41       linenr_T          linenr;
42 !     long              ins_len, pre_textlen = 0;
43       char_u            *firstline;
44       char_u            *ins_text, *newp, *oldp;
45       struct block_def  bd;
46 --- 2534,2542 ----
47   #ifdef FEAT_VISUALEXTRA
48       long              offset;
49       linenr_T          linenr;
50 !     long              ins_len;
51 !     long              pre_textlen = 0;
52 !     long              pre_indent = 0;
53       char_u            *firstline;
54       char_u            *ins_text, *newp, *oldp;
55       struct block_def  bd;
56 ***************
57 *** 2579,2585 ****
58                                                     || gchar_cursor() == NUL))
59             coladvance_force(getviscol());
60   # endif
61 !       pre_textlen = (long)STRLEN(ml_get(oap->start.lnum));
62         bd.textcol = curwin->w_cursor.col;
63       }
64   #endif
65 --- 2581,2589 ----
66                                                     || gchar_cursor() == NUL))
67             coladvance_force(getviscol());
68   # endif
69 !       firstline = ml_get(oap->start.lnum);
70 !       pre_textlen = (long)STRLEN(firstline);
71 !       pre_indent = (long)(skipwhite(firstline) - firstline);
72         bd.textcol = curwin->w_cursor.col;
73       }
74   #endif
75 ***************
76 *** 2598,2610 ****
77        */
78       if (oap->block_mode && oap->start.lnum != oap->end.lnum)
79       {
80         firstline = ml_get(oap->start.lnum);
81 !       /*
82 !        * Subsequent calls to ml_get() flush the firstline data - take a
83 !        * copy of the required bit.
84 !        */
85 !       if ((ins_len = (long)STRLEN(firstline) - pre_textlen) > 0)
86         {
87             if ((ins_text = alloc_check((unsigned)(ins_len + 1))) != NULL)
88             {
89                 vim_strncpy(ins_text, firstline + bd.textcol, (size_t)ins_len);
90 --- 2602,2623 ----
91        */
92       if (oap->block_mode && oap->start.lnum != oap->end.lnum)
93       {
94 +       /* Auto-indenting may have changed the indent.  If the cursor was past
95 +        * the indent, exclude that indent change from the inserted text. */
96         firstline = ml_get(oap->start.lnum);
97 !       if (bd.textcol > pre_indent)
98 !       {
99 !           long new_indent = (long)(skipwhite(firstline) - firstline);
100
101 !           pre_textlen += new_indent - pre_indent;
102 !           bd.textcol += new_indent - pre_indent;
103 !       }
104
105 !       ins_len = (long)STRLEN(firstline) - pre_textlen;
106 !       if (ins_len > 0)
107         {
108 +           /* Subsequent calls to ml_get() flush the firstline data - take a
109 +            * copy of the inserted text.  */
110             if ((ins_text = alloc_check((unsigned)(ins_len + 1))) != NULL)
111             {
112                 vim_strncpy(ins_text, firstline + bd.textcol, (size_t)ins_len);
113 *** ../vim-7.1.106/src/version.c        Thu Sep 13 22:04:30 2007
114 --- src/version.c       Thu Sep 13 22:38:28 2007
115 ***************
116 *** 668,669 ****
117 --- 668,671 ----
118   {   /* Add new patch number below this line */
119 + /**/
120 +     107,
121   /**/
122
123 -- 
124 Windows
125 M!uqoms
126
127  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
128 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
129 \\\        download, build and distribute -- http://www.A-A-P.org        ///
130  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.099189 seconds and 3 git commands to generate.