Changeset d754b0a for fmtext.c


Ignore:
Timestamp:
Apr 19, 2007, 12:06:43 AM (14 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
4099cf8
Parents:
85d1795
Message:
Fix a bug reported by ike (among others) about colors leaking past
@()'s.  Color is now contained by any currently recognized non-color
zephyr formatting command (b, bold, i, italic), as well as a noop
formatting command @().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fmtext.c

    rc2c5c77 rd754b0a  
    453453  int stacksize, curattrs, curcolor;
    454454  char *ptr, *txtptr, *buff, *tmpptr;
    455   int attrstack[32], chrstack[32];
     455  int attrstack[32], chrstack[32], colorstack[32];
    456456
    457457  curattrs=OWL_FMTEXT_ATTR_NONE;
     
    508508        attrstack[stacksize]=OWL_FMTEXT_ATTR_BOLD;
    509509        chrstack[stacksize]=tmpptr[0];
     510        colorstack[stacksize]=curcolor;
    510511        stacksize++;
    511512        curattrs|=OWL_FMTEXT_ATTR_BOLD;
     
    516517        attrstack[stacksize]=OWL_FMTEXT_ATTR_BOLD;
    517518        chrstack[stacksize]=tmpptr[0];
     519        colorstack[stacksize]=curcolor;
    518520        stacksize++;
    519521        curattrs|=OWL_FMTEXT_ATTR_BOLD;
     
    524526        attrstack[stacksize]=OWL_FMTEXT_ATTR_UNDERLINE;
    525527        chrstack[stacksize]=tmpptr[0];
     528        colorstack[stacksize]=curcolor;
    526529        stacksize++;
    527530        curattrs|=OWL_FMTEXT_ATTR_UNDERLINE;
     
    532535        attrstack[stacksize]=OWL_FMTEXT_ATTR_UNDERLINE;
    533536        chrstack[stacksize]=tmpptr[0];
     537        colorstack[stacksize]=curcolor;
    534538        stacksize++;
    535539        curattrs|=OWL_FMTEXT_ATTR_UNDERLINE;
    536540        txtptr+=8;
     541        owl_free(buff);
     542        continue;
     543      } else if (!strcasecmp(buff, "@")) {
     544        attrstack[stacksize]=OWL_FMTEXT_ATTR_NONE;
     545        chrstack[stacksize]=tmpptr[0];
     546        colorstack[stacksize]=curcolor;
     547        stacksize++;
     548        txtptr+=2;
    537549        owl_free(buff);
    538550        continue;
     
    608620        stacksize--;
    609621        curattrs=OWL_FMTEXT_ATTR_NONE;
     622        curcolor = colorstack[stacksize];
    610623        for (i=0; i<stacksize; i++) {
    611624          curattrs|=attrstack[i];
Note: See TracChangeset for help on using the changeset viewer.