Changes in fmtext.c [6f6330b:1490327]
Legend:
- Unmodified
- Added
- Removed
-
fmtext.c
r6f6330b r1490327 90 90 } 91 91 92 /* Append normal, uncolored text specified by format string to 'f' */ 93 void owl_fmtext_appendf_normal(owl_fmtext *f, char *fmt, ...) 94 { 95 va_list ap; 96 char *buff; 97 98 va_start(ap, fmt); 99 buff = g_strdup_vprintf(fmt, ap); 100 va_end(ap); 101 if (!buff) 102 return; 103 owl_fmtext_append_attr(f, buff, OWL_FMTEXT_ATTR_NONE, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT); 104 } 105 92 106 /* Append normal text 'text' to 'f' with color 'color' */ 93 107 void owl_fmtext_append_normal_color(owl_fmtext *f, char *text, int fgcolor, int bgcolor) … … 169 183 170 184 /* Internal function. Append text from 'in' between index 'start' and 171 * 'stop' to the end of 'f' 185 * 'stop', inclusive, to the end of 'f'. This function works with 186 * bytes. 172 187 */ 173 188 void _owl_fmtext_append_fmtext(owl_fmtext *f, owl_fmtext *in, int start, int stop) /*noproto*/ … … 474 489 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - in->textbuff); 475 490 } 491 else if (chwidth > 1) { 492 /* Last char is wide, truncate. */ 493 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - in->textbuff - 1); 494 owl_fmtext_append_normal(out, "\n"); 495 } 476 496 else { 477 if (chwidth > 1) { 478 /* Last char is wide, truncate. */ 479 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - in->textbuff - 1); 480 owl_fmtext_append_normal(out, "\n"); 481 } 482 else { 483 /* Last char fits perfectly, leave alone.*/ 484 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - in->textbuff); 485 } 497 /* Last char fits perfectly, We skip to the next char and back 498 * up a byte to make sure we get it all. 499 */ 500 ptr_c = g_utf8_next_char(ptr_c); 501 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - in->textbuff - 1); 486 502 } 487 503 } … … 763 779 * If format_fn is specified, passes it the list element value 764 780 * and it will return a string which this needs to free. */ 765 void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)( void*))781 void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)(char *)) 766 782 { 767 783 int i, size; 768 void*elem;784 char *elem; 769 785 char *text; 770 786
Note: See TracChangeset
for help on using the changeset viewer.