- Timestamp:
- Jul 31, 2010, 7:11:42 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- 2b83ad6
- Parents:
- e0e0e5a
- git-author:
- David Benjamin <davidben@mit.edu> (07/25/10 17:51:14)
- git-committer:
- David Benjamin <davidben@mit.edu> (07/31/10 19:11:42)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fmtext.c
re0e0e5a rc93b8b5 503 503 { 504 504 int lines, i; 505 506 if (f->textlen==0) return(0); 507 505 char *lastbreak, *p; 506 508 507 lines=0; 508 lastbreak = f->textbuff; 509 509 for (i=0; i<f->textlen; i++) { 510 if (f->textbuff[i]=='\n') lines++; 511 } 512 513 /* if the last char wasn't a \n there's one more line */ 514 if (f->textbuff[i-1]!='\n') lines++; 510 if (f->textbuff[i]=='\n') { 511 lastbreak = f->textbuff + i; 512 lines++; 513 } 514 } 515 516 /* Check if there's a trailing line; formatting characters don't count. */ 517 for (p = g_utf8_next_char(lastbreak); 518 p < f->textbuff + f->textlen; 519 p = g_utf8_next_char(p)) { 520 if (!owl_fmtext_is_format_char(g_utf8_get_char(p))) { 521 lines++; 522 break; 523 } 524 } 515 525 516 526 return(lines);
Note: See TracChangeset
for help on using the changeset viewer.