comparison src/misc1.c @ 840:2c885fab04e3 v7.0e06

updated for version 7.0e06
author vimboss
date Sat, 22 Apr 2006 22:33:57 +0000
parents 8e5830943bff
children 8cd729851562
comparison
equal deleted inserted replaced
839:1f3b1021f002 840:2c885fab04e3
319 { 319 {
320 --todo; 320 --todo;
321 ++ind_done; 321 ++ind_done;
322 } 322 }
323 ++ind_len; 323 ++ind_len;
324 if (round == 2) 324 if (p != NULL)
325 *p++ = *s; 325 *p++ = *s;
326 ++s; 326 ++s;
327 } 327 }
328 328
329 /* Fill to next tabstop with a tab, if possible */ 329 /* Fill to next tabstop with a tab, if possible */
330 tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts); 330 tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts);
331 if (todo >= tab_pad) 331 if (todo >= tab_pad)
332 { 332 {
333 todo -= tab_pad; 333 todo -= tab_pad;
334 ++ind_len; 334 ++ind_len;
335 if (round == 2) 335 if (p != NULL)
336 *p++ = TAB; 336 *p++ = TAB;
337 } 337 }
338 338
339 /* Add tabs required for indent */ 339 /* Add tabs required for indent */
340 while (todo >= (int)curbuf->b_p_ts) 340 while (todo >= (int)curbuf->b_p_ts)
341 { 341 {
342 todo -= (int)curbuf->b_p_ts; 342 todo -= (int)curbuf->b_p_ts;
343 ++ind_len; 343 ++ind_len;
344 if (round == 2) 344 if (p != NULL)
345 *p++ = TAB; 345 *p++ = TAB;
346 } 346 }
347 347
348 /* Count/add spaces required for indent */ 348 /* Count/add spaces required for indent */
349 while (todo > 0) 349 while (todo > 0)
350 { 350 {
351 --todo; 351 --todo;
352 ++ind_len; 352 ++ind_len;
353 if (round == 2) 353 if (p != NULL)
354 *p++ = ' '; 354 *p++ = ' ';
355 } 355 }
356 356
357 if (round == 1) 357 if (p == NULL)
358 { 358 {
359 /* Allocate memory for the result: the copied indent, new indent 359 /* Allocate memory for the result: the copied indent, new indent
360 * and the rest of the line. */ 360 * and the rest of the line. */
361 line_len = (int)STRLEN(ml_get_curline()) + 1; 361 line_len = (int)STRLEN(ml_get_curline()) + 1;
362 line = alloc(ind_len + line_len); 362 line = alloc(ind_len + line_len);