ClangCodeModel: Derive displayed search term from adjusted cursor

Otherwise, we can have discrepancies between displayed and actual search
term.

Change-Id: Iadd2ec54db4cef4b103c3c0ef98eb47828ea544b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-06-09 13:24:33 +02:00
parent 428a2c3c14
commit 9ee60ecd87

View File

@@ -1061,11 +1061,11 @@ void ClangdClient::findUsages(TextDocument *document, const QTextCursor &cursor,
const Utils::optional<QString> &replacement)
{
// Quick check: Are we even on anything searchable?
const QString searchTerm = d->searchTermFromCursor(cursor);
const QTextCursor adjustedCursor = d->adjustedCursor(cursor, document);
const QString searchTerm = d->searchTermFromCursor(adjustedCursor);
if (searchTerm.isEmpty())
return;
const QTextCursor adjustedCursor = d->adjustedCursor(cursor, document);
const bool categorize = CppEditor::codeModelSettings()->categorizeFindReferences();
// If it's a "normal" symbol, go right ahead.