1
0
Fork 0

gui: PreviewGeneratorPlainText: Don't add header if we have nothing to show

Dieser Commit ist enthalten in:
Albert S. 2023-05-07 17:08:48 +02:00
Ursprung 4b3ebb08c2
Commit 50a5c399c4
1 geänderte Dateien mit 13 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -246,17 +246,21 @@ QString PreviewGeneratorPlainText::generateLineBasedPreviewText(QTextStream &in,
totalWordCountMap[it->first] = totalWordCountMap.value(it->first, 0) + it->second;
}
}
if(isTruncated)
if(!resultText.isEmpty())
{
header += "(truncated) ";
}
for(QString &word : config.wordsToHighlight)
{
header += word + ": " + QString::number(totalWordCountMap[word]) + " ";
}
header += "<hr>";
if(isTruncated)
{
header += "(truncated) ";
}
for(QString &word : config.wordsToHighlight)
{
header += word + ": " + QString::number(totalWordCountMap[word]) + " ";
}
header += "<hr>";
return header + resultText;
resultText = header + resultText;
}
return resultText;
}
QSharedPointer<PreviewResult> PreviewGeneratorPlainText::generate(RenderConfig config, QString documentPath,