- Timestamp:
- Aug 2, 2010, 11:38:03 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- fd03b12
- Parents:
- 30da473
- git-author:
- David Benjamin <davidben@mit.edu> (07/25/10 18:58:30)
- git-committer:
- David Benjamin <davidben@mit.edu> (08/02/10 23:38:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fmtext.c
r30da473 re0022d2 450 450 } 451 451 452 /* Truncate the message so that each line begins at column 'acol' and 453 * ends at 'bcol' or sooner. The first column is number 0. The new 454 * message is placed in 'out'. The message is expected to end in a 455 * new line for now. 456 * 457 * NOTE: This needs to be modified to deal with backing up if we find 458 * a SPACING COMBINING MARK at the end of a line. If that happens, we 459 * should back up to the last non-mark character and stop there. 460 * 461 * NOTE: If a line ends at bcol, we omit the newline. This is so printing 462 * to ncurses works. 463 */ 464 void owl_fmtext_truncate_cols(const owl_fmtext *in, int acol, int bcol, owl_fmtext *out) 452 /* Implementation of owl_fmtext_truncate_cols. Does not support tabs in input. */ 453 void _owl_fmtext_truncate_cols_internal(const owl_fmtext *in, int acol, int bcol, owl_fmtext *out) 465 454 { 466 455 const char *ptr_s, *ptr_e, *ptr_c, *last; … … 536 525 } 537 526 527 /* Truncate the message so that each line begins at column 'acol' and 528 * ends at 'bcol' or sooner. The first column is number 0. The new 529 * message is placed in 'out'. The message is expected to end in a 530 * new line for now. 531 * 532 * NOTE: This needs to be modified to deal with backing up if we find 533 * a SPACING COMBINING MARK at the end of a line. If that happens, we 534 * should back up to the last non-mark character and stop there. 535 * 536 * NOTE: If a line ends at bcol, we omit the newline. This is so printing 537 * to ncurses works. 538 */ 539 void owl_fmtext_truncate_cols(const owl_fmtext *in, int acol, int bcol, owl_fmtext *out) 540 { 541 owl_fmtext notabs; 542 543 /* _owl_fmtext_truncate_cols_internal cannot handle tabs. */ 544 if (strchr(in->textbuff, '\t')) { 545 owl_fmtext_init_null(¬abs); 546 owl_fmtext_expand_tabs(in, ¬abs, 0); 547 _owl_fmtext_truncate_cols_internal(¬abs, acol, bcol, out); 548 owl_fmtext_cleanup(¬abs); 549 } else { 550 _owl_fmtext_truncate_cols_internal(in, acol, bcol, out); 551 } 552 } 553 538 554 /* Return the number of lines in 'f' */ 539 555 int owl_fmtext_num_lines(const owl_fmtext *f)
Note: See TracChangeset
for help on using the changeset viewer.