[Kst] extragear/graphics/kst

George Staikos staikos at kde.org
Mon May 15 21:40:25 CEST 2006


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...
 }
 


More information about the Kst mailing list