CppEditor: reduce complexity of getting previous line

for a given text cursor.

Change-Id: I43591b529e9d04b3ef013db3b9b30cf37773c115
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2023-05-09 15:54:09 +02:00
parent 03e14c264c
commit 266202b6b4
2 changed files with 2 additions and 15 deletions

View File

@@ -44,16 +44,6 @@ void DoxygenGenerator::setAddLeadingAsterisks(bool add)
m_addLeadingAsterisks = add;
}
static int lineBeforeCursor(const QTextCursor &cursor)
{
int line, column;
const bool converted = Utils::Text::convertPosition(cursor.document(), cursor.position(), &line,
&column);
QTC_ASSERT(converted, return std::numeric_limits<int>::max());
return line - 1;
}
QString DoxygenGenerator::generate(QTextCursor cursor,
const CPlusPlus::Snapshot &snapshot,
const Utils::FilePath &documentFilePath)
@@ -104,7 +94,7 @@ QString DoxygenGenerator::generate(QTextCursor cursor,
Document::Ptr doc = snapshot.preprocessedDocument(declCandidate.toUtf8(),
documentFilePath,
lineBeforeCursor(initialCursor));
cursor.blockNumber());
doc->parse(Document::ParseDeclaration);
doc->check(Document::FastCheck);