From 4261878a6437a6306418b3d665bfc138c63c7cae Mon Sep 17 00:00:00 2001
From: Leandro Melo
Date: Mon, 17 Jan 2011 10:25:41 +0100
Subject: [PATCH] Tooltips: Fix for first paragraph without punctuation
Task-number: QTCREATORBUG-3464
---
src/libs/utils/htmldocextractor.cpp | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/libs/utils/htmldocextractor.cpp b/src/libs/utils/htmldocextractor.cpp
index cb82a3cb08..2b7a1a28b5 100644
--- a/src/libs/utils/htmldocextractor.cpp
+++ b/src/libs/utils/htmldocextractor.cpp
@@ -210,17 +210,16 @@ void HtmlDocExtractor::processOutput(QString *html) const
// is cleared to avoid too much content.
int index = html->indexOf(QLatin1String(""));
if (index != -1 && index < 400) {
- index = html->indexOf(QLatin1String("
"), index + 2);
+ index = html->indexOf(QLatin1String("
"), 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: This is a description. Example:
+ const int period = html->lastIndexOf(QLatin1Char('.'), index);
+ if (period != -1) {
+ html->truncate(period + 1);
+ html->append(QLatin1String(""));
} else {
- // Paragraphs similar to this. Example:
- index = html->lastIndexOf(QLatin1Char('.'), index);
- if (index != -1) {
- html->truncate(index);
- html->append(QLatin1String("."));
- }
+ html->truncate(index + 4);
}
} else {
html->clear();
--
2.11.0