]>
Commit | Line | Data |
---|---|---|
59ab3540 AM |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.333 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.333 | |
11 | Problem: Using "." to repeat a Visual delete counts the size in bytes, not | |
12 | characters. (Connor Lane Smith) | |
13 | Solution: Store the virtual column numbers instead of byte positions. | |
14 | Files: src/normal.c | |
15 | ||
16 | ||
17 | *** ../vim-7.3.332/src/normal.c 2011-07-15 17:51:30.000000000 +0200 | |
18 | --- src/normal.c 2011-10-04 19:47:14.000000000 +0200 | |
19 | *************** | |
20 | *** 20,26 **** | |
21 | */ | |
22 | static int resel_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */ | |
23 | static linenr_T resel_VIsual_line_count; /* number of lines */ | |
24 | ! static colnr_T resel_VIsual_col; /* nr of cols or end col */ | |
25 | ||
26 | static int restart_VIsual_select = 0; | |
27 | #endif | |
28 | --- 20,26 ---- | |
29 | */ | |
30 | static int resel_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */ | |
31 | static linenr_T resel_VIsual_line_count; /* number of lines */ | |
32 | ! static colnr_T resel_VIsual_vcol; /* nr of cols or end col */ | |
33 | ||
34 | static int restart_VIsual_select = 0; | |
35 | #endif | |
36 | *************** | |
37 | *** 1436,1442 **** | |
38 | /* The visual area is remembered for redo */ | |
39 | static int redo_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */ | |
40 | static linenr_T redo_VIsual_line_count; /* number of lines */ | |
41 | ! static colnr_T redo_VIsual_col; /* number of cols or end column */ | |
42 | static long redo_VIsual_count; /* count for Visual operator */ | |
43 | # ifdef FEAT_VIRTUALEDIT | |
44 | int include_line_break = FALSE; | |
45 | --- 1436,1442 ---- | |
46 | /* The visual area is remembered for redo */ | |
47 | static int redo_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */ | |
48 | static linenr_T redo_VIsual_line_count; /* number of lines */ | |
49 | ! static colnr_T redo_VIsual_vcol; /* number of cols or end column */ | |
50 | static long redo_VIsual_count; /* count for Visual operator */ | |
51 | # ifdef FEAT_VIRTUALEDIT | |
52 | int include_line_break = FALSE; | |
53 | *************** | |
54 | *** 1549,1570 **** | |
55 | #ifdef FEAT_VISUAL | |
56 | if (redo_VIsual_busy) | |
57 | { | |
58 | oap->start = curwin->w_cursor; | |
59 | curwin->w_cursor.lnum += redo_VIsual_line_count - 1; | |
60 | if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) | |
61 | curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; | |
62 | VIsual_mode = redo_VIsual_mode; | |
63 | ! if (VIsual_mode == 'v') | |
64 | { | |
65 | ! if (redo_VIsual_line_count <= 1) | |
66 | ! curwin->w_cursor.col += redo_VIsual_col - 1; | |
67 | else | |
68 | ! curwin->w_cursor.col = redo_VIsual_col; | |
69 | ! } | |
70 | ! if (redo_VIsual_col == MAXCOL) | |
71 | ! { | |
72 | ! curwin->w_curswant = MAXCOL; | |
73 | ! coladvance((colnr_T)MAXCOL); | |
74 | } | |
75 | cap->count0 = redo_VIsual_count; | |
76 | if (redo_VIsual_count != 0) | |
77 | --- 1549,1579 ---- | |
78 | #ifdef FEAT_VISUAL | |
79 | if (redo_VIsual_busy) | |
80 | { | |
81 | + /* Redo of an operation on a Visual area. Use the same size from | |
82 | + * redo_VIsual_line_count and redo_VIsual_vcol. */ | |
83 | oap->start = curwin->w_cursor; | |
84 | curwin->w_cursor.lnum += redo_VIsual_line_count - 1; | |
85 | if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) | |
86 | curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; | |
87 | VIsual_mode = redo_VIsual_mode; | |
88 | ! if (redo_VIsual_vcol == MAXCOL || VIsual_mode == 'v') | |
89 | { | |
90 | ! if (VIsual_mode == 'v') | |
91 | ! { | |
92 | ! if (redo_VIsual_line_count <= 1) | |
93 | ! { | |
94 | ! validate_virtcol(); | |
95 | ! curwin->w_curswant = | |
96 | ! curwin->w_virtcol + redo_VIsual_vcol - 1; | |
97 | ! } | |
98 | ! else | |
99 | ! curwin->w_curswant = redo_VIsual_vcol; | |
100 | ! } | |
101 | else | |
102 | ! { | |
103 | ! curwin->w_curswant = MAXCOL; | |
104 | ! } | |
105 | ! coladvance(curwin->w_curswant); | |
106 | } | |
107 | cap->count0 = redo_VIsual_count; | |
108 | if (redo_VIsual_count != 0) | |
109 | *************** | |
110 | *** 1710,1716 **** | |
111 | } | |
112 | } | |
113 | else if (redo_VIsual_busy) | |
114 | ! oap->end_vcol = oap->start_vcol + redo_VIsual_col - 1; | |
115 | /* | |
116 | * Correct oap->end.col and oap->start.col to be the | |
117 | * upper-left and lower-right corner of the block area. | |
118 | --- 1719,1725 ---- | |
119 | } | |
120 | } | |
121 | else if (redo_VIsual_busy) | |
122 | ! oap->end_vcol = oap->start_vcol + redo_VIsual_vcol - 1; | |
123 | /* | |
124 | * Correct oap->end.col and oap->start.col to be the | |
125 | * upper-left and lower-right corner of the block area. | |
126 | *************** | |
127 | *** 1735,1747 **** | |
128 | */ | |
129 | resel_VIsual_mode = VIsual_mode; | |
130 | if (curwin->w_curswant == MAXCOL) | |
131 | ! resel_VIsual_col = MAXCOL; | |
132 | ! else if (VIsual_mode == Ctrl_V) | |
133 | ! resel_VIsual_col = oap->end_vcol - oap->start_vcol + 1; | |
134 | ! else if (oap->line_count > 1) | |
135 | ! resel_VIsual_col = oap->end.col; | |
136 | else | |
137 | ! resel_VIsual_col = oap->end.col - oap->start.col + 1; | |
138 | resel_VIsual_line_count = oap->line_count; | |
139 | } | |
140 | ||
141 | --- 1744,1765 ---- | |
142 | */ | |
143 | resel_VIsual_mode = VIsual_mode; | |
144 | if (curwin->w_curswant == MAXCOL) | |
145 | ! resel_VIsual_vcol = MAXCOL; | |
146 | else | |
147 | ! { | |
148 | ! if (VIsual_mode != Ctrl_V) | |
149 | ! getvvcol(curwin, &(oap->end), | |
150 | ! NULL, NULL, &oap->end_vcol); | |
151 | ! if (VIsual_mode == Ctrl_V || oap->line_count <= 1) | |
152 | ! { | |
153 | ! if (VIsual_mode != Ctrl_V) | |
154 | ! getvvcol(curwin, &(oap->start), | |
155 | ! &oap->start_vcol, NULL, NULL); | |
156 | ! resel_VIsual_vcol = oap->end_vcol - oap->start_vcol + 1; | |
157 | ! } | |
158 | ! else | |
159 | ! resel_VIsual_vcol = oap->end_vcol; | |
160 | ! } | |
161 | resel_VIsual_line_count = oap->line_count; | |
162 | } | |
163 | ||
164 | *************** | |
165 | *** 1769,1775 **** | |
166 | if (!redo_VIsual_busy) | |
167 | { | |
168 | redo_VIsual_mode = resel_VIsual_mode; | |
169 | ! redo_VIsual_col = resel_VIsual_col; | |
170 | redo_VIsual_line_count = resel_VIsual_line_count; | |
171 | redo_VIsual_count = cap->count0; | |
172 | } | |
173 | --- 1787,1793 ---- | |
174 | if (!redo_VIsual_busy) | |
175 | { | |
176 | redo_VIsual_mode = resel_VIsual_mode; | |
177 | ! redo_VIsual_vcol = resel_VIsual_vcol; | |
178 | redo_VIsual_line_count = resel_VIsual_line_count; | |
179 | redo_VIsual_count = cap->count0; | |
180 | } | |
181 | *************** | |
182 | *** 7631,7642 **** | |
183 | if (VIsual_mode == 'v') | |
184 | { | |
185 | if (resel_VIsual_line_count <= 1) | |
186 | ! curwin->w_cursor.col += resel_VIsual_col * cap->count0 - 1; | |
187 | else | |
188 | ! curwin->w_cursor.col = resel_VIsual_col; | |
189 | ! check_cursor_col(); | |
190 | } | |
191 | ! if (resel_VIsual_col == MAXCOL) | |
192 | { | |
193 | curwin->w_curswant = MAXCOL; | |
194 | coladvance((colnr_T)MAXCOL); | |
195 | --- 7649,7664 ---- | |
196 | if (VIsual_mode == 'v') | |
197 | { | |
198 | if (resel_VIsual_line_count <= 1) | |
199 | ! { | |
200 | ! validate_virtcol(); | |
201 | ! curwin->w_curswant = curwin->w_virtcol | |
202 | ! + resel_VIsual_vcol * cap->count0 - 1; | |
203 | ! } | |
204 | else | |
205 | ! curwin->w_curswant = resel_VIsual_vcol; | |
206 | ! coladvance(curwin->w_curswant); | |
207 | } | |
208 | ! if (resel_VIsual_vcol == MAXCOL) | |
209 | { | |
210 | curwin->w_curswant = MAXCOL; | |
211 | coladvance((colnr_T)MAXCOL); | |
212 | *************** | |
213 | *** 7645,7651 **** | |
214 | { | |
215 | validate_virtcol(); | |
216 | curwin->w_curswant = curwin->w_virtcol | |
217 | ! + resel_VIsual_col * cap->count0 - 1; | |
218 | coladvance(curwin->w_curswant); | |
219 | } | |
220 | else | |
221 | --- 7667,7673 ---- | |
222 | { | |
223 | validate_virtcol(); | |
224 | curwin->w_curswant = curwin->w_virtcol | |
225 | ! + resel_VIsual_vcol * cap->count0 - 1; | |
226 | coladvance(curwin->w_curswant); | |
227 | } | |
228 | else | |
229 | *** ../vim-7.3.332/src/version.c 2011-10-04 18:03:43.000000000 +0200 | |
230 | --- src/version.c 2011-10-04 21:05:44.000000000 +0200 | |
231 | *************** | |
232 | *** 711,712 **** | |
233 | --- 711,714 ---- | |
234 | { /* Add new patch number below this line */ | |
235 | + /**/ | |
236 | + 333, | |
237 | /**/ | |
238 | ||
239 | -- | |
240 | It was recently discovered that research causes cancer in rats. | |
241 | ||
242 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
243 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
244 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
245 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |