- Timestamp:
- Jan 4, 2008, 2:31:55 PM (17 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 6d77f1f
- Parents:
- 830c36e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fmtext.c
r987a93c r3a7cf49 399 399 * ends at 'bcol' or sooner. The first column is number 0. The new 400 400 * message is placed in 'out'. The message is * expected to end in a 401 * new line for now 401 * new line for now. NOTE: This needs to be modified to deal with 402 * backing up if we find a SPACING COMBINING MARK at the end of a 403 * line. If that happens, we should back up to the last non-mark 404 * character and stop there. 402 405 */ 403 406 void owl_fmtext_truncate_cols(owl_fmtext *in, int acol, int bcol, owl_fmtext *out) … … 426 429 chwidth = 0; 427 430 ptr_c = ptr_s; 428 while( col <= bcol &&ptr_c < ptr_e) {431 while(ptr_c < ptr_e) { 429 432 gunichar c = g_utf8_get_char(ptr_c); 430 433 if (!_owl_fmtext_is_format_char(c)) { 431 434 chwidth = mk_wcwidth(c); 432 433 if (col + chwidth > bcol) 434 break; 435 if (col + chwidth > bcol) break; 436 435 437 if (col >= acol) { 436 438 if (st == 0) { … … 448 450 /* lead padding */ 449 451 owl_fmtext_append_spaces(out, padding); 450 if (ptr_c[0] & 0x80) { 451 if (col + chwidth == bcol) 452 ptr_c = g_utf8_next_char(ptr_c); 453 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - 1 - in->textbuff); 454 owl_fmtext_append_normal(out, "\n"); 452 if (ptr_c == ptr_e) { 453 /* We made it to the newline. */ 454 owl_function_debugmsg("fmtc: reached newline"); 455 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - in->textbuff); 455 456 } 456 457 else { 457 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - in->textbuff); 458 if (chwidth > 1) { 459 /* Last char is wide, truncate. */ 460 owl_function_debugmsg("fmtc: truncating."); 461 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - in->textbuff - 1); 462 owl_fmtext_append_normal(out, "\n"); 463 } 464 else { 465 /* Last char fits perfectly, leave alone.*/ 466 owl_function_debugmsg("fmtc: fits fine."); 467 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - in->textbuff); 468 } 458 469 } 459 470 }
Note: See TracChangeset
for help on using the changeset viewer.