Commit 4261878a authored by Leandro Melo's avatar Leandro Melo
Browse files

Tooltips: Fix for first paragraph without punctuation

Task-number: QTCREATORBUG-3464
parent 61f708cf
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment