| Summary: | Label color does not revert to default | ||
|---|---|---|---|
| Product: | [Applications] kst | Reporter: | Andrew Walker <arwalker> |
| Component: | general | Assignee: | kst |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.x | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
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...
}
|
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