Bug 127381 - Label color does not revert to default
Summary: Label color does not revert to default
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-15 20:47 UTC by Andrew Walker
Modified: 2006-05-15 21:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2006-05-15 20:47:29 UTC
Version:           HEAD (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources
OS:                Linux

STEPS TO REPRODUCE:
Start Kst
Create a label with the following text:
\textcolor{red}{aa}bb
Set the font color to black

RESULTS:
The label "aabb" is displayed with all the text in red

EXPECTED RESULTS:
The label "aabb" is displayed with "aa" in red and "bb" in black
Comment 1 George Staikos 2006-05-15 21:40:42 UTC
SVN commit 541239 by staikos:

Fix off-by-one in color parsing
BUG: 127381


 M  +1 -1      src/libkstmath/labelparser.cpp  
 M  +9 -1      tests/testlabelparser.cpp  


--- trunk/extragear/graphics/kst/src/libkstmath/labelparser.cpp #541238:541239
@@ -341,7 +341,7 @@
         if (!working->attributes.color.isValid() || txt[parseStart + firstSkip + 1] != '{') {
           return false;
         }
-        parseStart += firstSkip + 1;
+        parseStart += firstSkip + 2;
         parseInternal(working, txt, parseStart, txt.length(), interpretNewLine);
         *skip = parseStart - from + 1;
         dumpattr(working, "end group for textcolor");
--- trunk/extragear/graphics/kst/tests/testlabelparser.cpp #541238:541239
@@ -15,7 +15,7 @@
 
 
 static void dumpAttributes(Label::Chunk *l, QString indent) {
-  printf("%sb:%d i:%d u:%d\n", indent.latin1(), l->attributes.bold, l->attributes.italic, l->attributes.underline);
+  printf("%sb:%d i:%d u:%d c:%s\n", indent.latin1(), l->attributes.bold, l->attributes.italic, l->attributes.underline, l->attributes.color.name().latin1());
 }
 
 
@@ -471,6 +471,14 @@
   // FIXME
   delete parsed;
 
+  parsed = Label::parse("\\textcolor{red}{red}black");
+  // FIXME
+  delete parsed;
+
+  parsed = Label::parse("\\textbf{bold}unbold");
+  // FIXME
+  delete parsed;
+
   // more to test...
 }