]>
Commit | Line | Data |
---|---|---|
d57b4abe ER |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.231 | |
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.231 | |
11 | Problem: When shifting lines the change is acted upon multiple times. | |
12 | Solution: Don't have shift_line() call changed_bytes. | |
13 | Files: src/edit.c, src/ops.c, src/proto/edit.pro, src/proto/ops.pro | |
14 | ||
15 | ||
16 | *** ../vim-7.1.230/src/edit.c Mon Jan 14 20:11:37 2008 | |
17 | --- src/edit.c Mon Jan 14 20:06:43 2008 | |
18 | *************** | |
19 | *** 1662,1672 **** | |
20 | * if round is TRUE, round the indent to 'shiftwidth' (only with _INC and _Dec). | |
21 | */ | |
22 | void | |
23 | ! change_indent(type, amount, round, replaced) | |
24 | int type; | |
25 | int amount; | |
26 | int round; | |
27 | int replaced; /* replaced character, put on replace stack */ | |
28 | { | |
29 | int vcol; | |
30 | int last_vcol; | |
31 | --- 1662,1673 ---- | |
32 | * if round is TRUE, round the indent to 'shiftwidth' (only with _INC and _Dec). | |
33 | */ | |
34 | void | |
35 | ! change_indent(type, amount, round, replaced, call_changed_bytes) | |
36 | int type; | |
37 | int amount; | |
38 | int round; | |
39 | int replaced; /* replaced character, put on replace stack */ | |
40 | + int call_changed_bytes; /* call changed_bytes() */ | |
41 | { | |
42 | int vcol; | |
43 | int last_vcol; | |
44 | *************** | |
45 | *** 1723,1729 **** | |
46 | * Set the new indent. The cursor will be put on the first non-blank. | |
47 | */ | |
48 | if (type == INDENT_SET) | |
49 | ! (void)set_indent(amount, SIN_CHANGED); | |
50 | else | |
51 | { | |
52 | #ifdef FEAT_VREPLACE | |
53 | --- 1724,1730 ---- | |
54 | * Set the new indent. The cursor will be put on the first non-blank. | |
55 | */ | |
56 | if (type == INDENT_SET) | |
57 | ! (void)set_indent(amount, call_changed_bytes ? SIN_CHANGED : 0); | |
58 | else | |
59 | { | |
60 | #ifdef FEAT_VREPLACE | |
61 | *************** | |
62 | *** 1733,1739 **** | |
63 | if (State & VREPLACE_FLAG) | |
64 | State = INSERT; | |
65 | #endif | |
66 | ! shift_line(type == INDENT_DEC, round, 1); | |
67 | #ifdef FEAT_VREPLACE | |
68 | State = save_State; | |
69 | #endif | |
70 | --- 1734,1740 ---- | |
71 | if (State & VREPLACE_FLAG) | |
72 | State = INSERT; | |
73 | #endif | |
74 | ! shift_line(type == INDENT_DEC, round, 1, call_changed_bytes); | |
75 | #ifdef FEAT_VREPLACE | |
76 | State = save_State; | |
77 | #endif | |
78 | *************** | |
79 | *** 5921,5927 **** | |
80 | { | |
81 | #ifdef FEAT_VREPLACE | |
82 | if (State & VREPLACE_FLAG) | |
83 | ! change_indent(INDENT_SET, second_indent, FALSE, NUL); | |
84 | else | |
85 | #endif | |
86 | (void)set_indent(second_indent, SIN_CHANGED); | |
87 | --- 5922,5928 ---- | |
88 | { | |
89 | #ifdef FEAT_VREPLACE | |
90 | if (State & VREPLACE_FLAG) | |
91 | ! change_indent(INDENT_SET, second_indent, FALSE, NUL, TRUE); | |
92 | else | |
93 | #endif | |
94 | (void)set_indent(second_indent, SIN_CHANGED); | |
95 | *************** | |
96 | *** 7227,7233 **** | |
97 | fixthisline(get_the_indent) | |
98 | int (*get_the_indent) __ARGS((void)); | |
99 | { | |
100 | ! change_indent(INDENT_SET, get_the_indent(), FALSE, 0); | |
101 | if (linewhite(curwin->w_cursor.lnum)) | |
102 | did_ai = TRUE; /* delete the indent if the line stays empty */ | |
103 | } | |
104 | --- 7228,7234 ---- | |
105 | fixthisline(get_the_indent) | |
106 | int (*get_the_indent) __ARGS((void)); | |
107 | { | |
108 | ! change_indent(INDENT_SET, get_the_indent(), FALSE, 0, TRUE); | |
109 | if (linewhite(curwin->w_cursor.lnum)) | |
110 | did_ai = TRUE; /* delete the indent if the line stays empty */ | |
111 | } | |
112 | *************** | |
113 | *** 8170,8179 **** | |
114 | replace_pop_ins(); | |
115 | if (lastc == '^') | |
116 | old_indent = get_indent(); /* remember curr. indent */ | |
117 | ! change_indent(INDENT_SET, 0, TRUE, 0); | |
118 | } | |
119 | else | |
120 | ! change_indent(c == Ctrl_D ? INDENT_DEC : INDENT_INC, 0, TRUE, 0); | |
121 | ||
122 | if (did_ai && *skipwhite(ml_get_curline()) != NUL) | |
123 | did_ai = FALSE; | |
124 | --- 8171,8180 ---- | |
125 | replace_pop_ins(); | |
126 | if (lastc == '^') | |
127 | old_indent = get_indent(); /* remember curr. indent */ | |
128 | ! change_indent(INDENT_SET, 0, TRUE, 0, TRUE); | |
129 | } | |
130 | else | |
131 | ! change_indent(c == Ctrl_D ? INDENT_DEC : INDENT_INC, 0, TRUE, 0, TRUE); | |
132 | ||
133 | if (did_ai && *skipwhite(ml_get_curline()) != NUL) | |
134 | did_ai = FALSE; | |
135 | *************** | |
136 | *** 9633,9639 **** | |
137 | curwin->w_cursor = old_pos; | |
138 | #ifdef FEAT_VREPLACE | |
139 | if (State & VREPLACE_FLAG) | |
140 | ! change_indent(INDENT_SET, i, FALSE, NUL); | |
141 | else | |
142 | #endif | |
143 | (void)set_indent(i, SIN_CHANGED); | |
144 | --- 9634,9640 ---- | |
145 | curwin->w_cursor = old_pos; | |
146 | #ifdef FEAT_VREPLACE | |
147 | if (State & VREPLACE_FLAG) | |
148 | ! change_indent(INDENT_SET, i, FALSE, NUL, TRUE); | |
149 | else | |
150 | #endif | |
151 | (void)set_indent(i, SIN_CHANGED); | |
152 | *************** | |
153 | *** 9662,9668 **** | |
154 | curwin->w_cursor = old_pos; | |
155 | } | |
156 | if (temp) | |
157 | ! shift_line(TRUE, FALSE, 1); | |
158 | } | |
159 | } | |
160 | ||
161 | --- 9663,9669 ---- | |
162 | curwin->w_cursor = old_pos; | |
163 | } | |
164 | if (temp) | |
165 | ! shift_line(TRUE, FALSE, 1, TRUE); | |
166 | } | |
167 | } | |
168 | ||
169 | *** ../vim-7.1.230/src/ops.c Thu Jan 3 16:31:17 2008 | |
170 | --- src/ops.c Sun Jan 13 21:52:18 2008 | |
171 | *************** | |
172 | *** 258,264 **** | |
173 | if (first_char != '#' || !preprocs_left()) | |
174 | #endif | |
175 | { | |
176 | ! shift_line(oap->op_type == OP_LSHIFT, p_sr, amount); | |
177 | } | |
178 | ++curwin->w_cursor.lnum; | |
179 | } | |
180 | --- 258,264 ---- | |
181 | if (first_char != '#' || !preprocs_left()) | |
182 | #endif | |
183 | { | |
184 | ! shift_line(oap->op_type == OP_LSHIFT, p_sr, amount, FALSE); | |
185 | } | |
186 | ++curwin->w_cursor.lnum; | |
187 | } | |
188 | *************** | |
189 | *** 321,330 **** | |
190 | * leaves cursor on first blank in the line | |
191 | */ | |
192 | void | |
193 | ! shift_line(left, round, amount) | |
194 | int left; | |
195 | int round; | |
196 | int amount; | |
197 | { | |
198 | int count; | |
199 | int i, j; | |
200 | --- 321,331 ---- | |
201 | * leaves cursor on first blank in the line | |
202 | */ | |
203 | void | |
204 | ! shift_line(left, round, amount, call_changed_bytes) | |
205 | int left; | |
206 | int round; | |
207 | int amount; | |
208 | + int call_changed_bytes; /* call changed_bytes() */ | |
209 | { | |
210 | int count; | |
211 | int i, j; | |
212 | *************** | |
213 | *** 363,372 **** | |
214 | /* Set new indent */ | |
215 | #ifdef FEAT_VREPLACE | |
216 | if (State & VREPLACE_FLAG) | |
217 | ! change_indent(INDENT_SET, count, FALSE, NUL); | |
218 | else | |
219 | #endif | |
220 | ! (void)set_indent(count, SIN_CHANGED); | |
221 | } | |
222 | ||
223 | #if defined(FEAT_VISUALEXTRA) || defined(PROTO) | |
224 | --- 364,373 ---- | |
225 | /* Set new indent */ | |
226 | #ifdef FEAT_VREPLACE | |
227 | if (State & VREPLACE_FLAG) | |
228 | ! change_indent(INDENT_SET, count, FALSE, NUL, call_changed_bytes); | |
229 | else | |
230 | #endif | |
231 | ! (void)set_indent(count, call_changed_bytes ? SIN_CHANGED : 0); | |
232 | } | |
233 | ||
234 | #if defined(FEAT_VISUALEXTRA) || defined(PROTO) | |
235 | *** ../vim-7.1.230/src/proto/edit.pro Wed Jan 2 17:48:24 2008 | |
236 | --- src/proto/edit.pro Sun Jan 13 21:52:27 2008 | |
237 | *************** | |
238 | *** 3,9 **** | |
239 | void edit_putchar __ARGS((int c, int highlight)); | |
240 | void edit_unputchar __ARGS((void)); | |
241 | void display_dollar __ARGS((colnr_T col)); | |
242 | ! void change_indent __ARGS((int type, int amount, int round, int replaced)); | |
243 | void truncate_spaces __ARGS((char_u *line)); | |
244 | void backspace_until_column __ARGS((int col)); | |
245 | int vim_is_ctrl_x_key __ARGS((int c)); | |
246 | --- 3,9 ---- | |
247 | void edit_putchar __ARGS((int c, int highlight)); | |
248 | void edit_unputchar __ARGS((void)); | |
249 | void display_dollar __ARGS((colnr_T col)); | |
250 | ! void change_indent __ARGS((int type, int amount, int round, int replaced, int call_changed_bytes)); | |
251 | void truncate_spaces __ARGS((char_u *line)); | |
252 | void backspace_until_column __ARGS((int col)); | |
253 | int vim_is_ctrl_x_key __ARGS((int c)); | |
254 | *** ../vim-7.1.230/src/proto/ops.pro Sun May 6 13:56:32 2007 | |
255 | --- src/proto/ops.pro Sun Jan 13 21:52:30 2008 | |
256 | *************** | |
257 | *** 4,10 **** | |
258 | int get_op_char __ARGS((int optype)); | |
259 | int get_extra_op_char __ARGS((int optype)); | |
260 | void op_shift __ARGS((oparg_T *oap, int curs_top, int amount)); | |
261 | ! void shift_line __ARGS((int left, int round, int amount)); | |
262 | void op_reindent __ARGS((oparg_T *oap, int (*how)(void))); | |
263 | int get_expr_register __ARGS((void)); | |
264 | void set_expr_line __ARGS((char_u *new_line)); | |
265 | --- 4,10 ---- | |
266 | int get_op_char __ARGS((int optype)); | |
267 | int get_extra_op_char __ARGS((int optype)); | |
268 | void op_shift __ARGS((oparg_T *oap, int curs_top, int amount)); | |
269 | ! void shift_line __ARGS((int left, int round, int amount, int call_changed_bytes)); | |
270 | void op_reindent __ARGS((oparg_T *oap, int (*how)(void))); | |
271 | int get_expr_register __ARGS((void)); | |
272 | void set_expr_line __ARGS((char_u *new_line)); | |
273 | *** ../vim-7.1.230/src/version.c Tue Jan 15 22:16:36 2008 | |
274 | --- src/version.c Wed Jan 16 19:58:25 2008 | |
275 | *************** | |
276 | *** 668,669 **** | |
277 | --- 668,671 ---- | |
278 | { /* Add new patch number below this line */ | |
279 | + /**/ | |
280 | + 231, | |
281 | /**/ | |
282 | ||
283 | -- | |
284 | Snoring is prohibited unless all bedroom windows are closed and securely | |
285 | locked. | |
286 | [real standing law in Massachusetts, United States of America] | |
287 | ||
288 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
289 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
290 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
291 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |