OSDN Git Service

Tooltips: Fix for first paragraph without punctuation
authorLeandro Melo <leandro.melo@nokia.com>
Mon, 17 Jan 2011 09:25:41 +0000 (10:25 +0100)
committerLeandro Melo <leandro.melo@nokia.com>
Mon, 17 Jan 2011 09:27:54 +0000 (10:27 +0100)
Task-number: QTCREATORBUG-3464

src/libs/utils/htmldocextractor.cpp

index cb82a3c..2b7a1a2 100644 (file)
@@ -210,17 +210,16 @@ void HtmlDocExtractor::processOutput(QString *html) const
         // is cleared to avoid too much content.
         int index = html->indexOf(QLatin1String("<p>"));
         if (index != -1 && index < 400) {
-            index = html->indexOf(QLatin1String("</p>"), index + 2);
+            index = html->indexOf(QLatin1String("</p>"), index + 3);
             if (index != -1) {
-                if (html->at(index - 1) == QLatin1Char('.')) {
-                    html->truncate(index + 4);
+                // Most paragraphs end with a period, but there are cases without punctuation
+                // and cases like this: <p>This is a description. Example:</p>
+                const int period = html->lastIndexOf(QLatin1Char('.'), index);
+                if (period != -1) {
+                    html->truncate(period + 1);
+                    html->append(QLatin1String("</p>"));
                 } else {
-                    // <p>Paragraphs similar to this. Example:</p>
-                    index = html->lastIndexOf(QLatin1Char('.'), index);
-                    if (index != -1) {
-                        html->truncate(index);
-                        html->append(QLatin1String(".</p>"));
-                    }
+                    html->truncate(index + 4);
                 }
             } else {
                 html->clear();