[586] in BarnOwl Developers
[D-O-H] r698 - trunk/owl
daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:07:41 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: asedeno@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Thu, 19 Apr 2007 00:06:44 -0400 (EDT)
Author: asedeno
Date: 2007-04-19 00:06:43 -0400 (Thu, 19 Apr 2007)
New Revision: 698
Modified:
trunk/owl/fmtext.c
Log:
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 @().
Modified: trunk/owl/fmtext.c
===================================================================
--- trunk/owl/fmtext.c 2007-04-17 01:54:27 UTC (rev 697)
+++ trunk/owl/fmtext.c 2007-04-19 04:06:43 UTC (rev 698)
@@ -452,7 +452,7 @@
{
int stacksize, curattrs, curcolor;
char *ptr, *txtptr, *buff, *tmpptr;
- int attrstack[32], chrstack[32];
+ int attrstack[32], chrstack[32], colorstack[32];
curattrs=OWL_FMTEXT_ATTR_NONE;
curcolor=OWL_COLOR_DEFAULT;
@@ -507,6 +507,7 @@
if (!strcasecmp(buff, "@bold")) {
attrstack[stacksize]=OWL_FMTEXT_ATTR_BOLD;
chrstack[stacksize]=tmpptr[0];
+ colorstack[stacksize]=curcolor;
stacksize++;
curattrs|=OWL_FMTEXT_ATTR_BOLD;
txtptr+=6;
@@ -515,6 +516,7 @@
} else if (!strcasecmp(buff, "@b")) {
attrstack[stacksize]=OWL_FMTEXT_ATTR_BOLD;
chrstack[stacksize]=tmpptr[0];
+ colorstack[stacksize]=curcolor;
stacksize++;
curattrs|=OWL_FMTEXT_ATTR_BOLD;
txtptr+=3;
@@ -523,6 +525,7 @@
} else if (!strcasecmp(buff, "@i")) {
attrstack[stacksize]=OWL_FMTEXT_ATTR_UNDERLINE;
chrstack[stacksize]=tmpptr[0];
+ colorstack[stacksize]=curcolor;
stacksize++;
curattrs|=OWL_FMTEXT_ATTR_UNDERLINE;
txtptr+=3;
@@ -531,11 +534,20 @@
} else if (!strcasecmp(buff, "@italic")) {
attrstack[stacksize]=OWL_FMTEXT_ATTR_UNDERLINE;
chrstack[stacksize]=tmpptr[0];
+ colorstack[stacksize]=curcolor;
stacksize++;
curattrs|=OWL_FMTEXT_ATTR_UNDERLINE;
txtptr+=8;
owl_free(buff);
continue;
+ } else if (!strcasecmp(buff, "@")) {
+ attrstack[stacksize]=OWL_FMTEXT_ATTR_NONE;
+ chrstack[stacksize]=tmpptr[0];
+ colorstack[stacksize]=curcolor;
+ stacksize++;
+ txtptr+=2;
+ owl_free(buff);
+ continue;
/* if it's a color read the color, set the current color and
continue */
@@ -607,6 +619,7 @@
int i;
stacksize--;
curattrs=OWL_FMTEXT_ATTR_NONE;
+ curcolor = colorstack[stacksize];
for (i=0; i<stacksize; i++) {
curattrs|=attrstack[i];
}