Editor: Adjust remaining usages of BaseTextEditor:convertPosition

amends 9bb126c0d6

Change-Id: I42b96f1f7364f75da88eccd7a86fc25b9cd1499d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
David Schulz
2023-05-25 15:18:12 +02:00
parent efdb67bf90
commit ea108f4857
4 changed files with 4 additions and 4 deletions

View File

@@ -378,7 +378,7 @@ void Manager::gotoLocations(const QList<QVariant> &list)
int line;
int column;
textEditor->convertPosition(textEditor->position(), &line, &column);
const SymbolLocation current(filePath, line, column);
const SymbolLocation current(filePath, line, column + 1);
if (auto it = locations.constFind(current), end = locations.constEnd(); it != end) {
// we already are at the symbol, cycle to next location
++it;

View File

@@ -157,7 +157,7 @@ void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
// find the beginning of a filename
QString buffer;
int beginPos = column - 1;
int beginPos = column;
while (beginPos >= 0) {
if (isValidFileNameChar(block, beginPos)) {
buffer.prepend(block.at(beginPos));

View File

@@ -414,6 +414,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
} else {
currentTextEditor->convertPosition(targetTestFile->m_targetCursorPosition,
&expectedLine, &expectedColumn);
++expectedColumn;
if (useClangd && (tag == "classDestructor" || tag == "fromDestructorDefinitionSymbol"
|| tag == "fromDestructorBody")) {
--expectedColumn; // clangd goes before the ~, built-in code model after

View File

@@ -357,8 +357,7 @@ void QmakeProjectManagerPluginPrivate::addLibraryImpl(const FilePath &filePath,
// add extra \n in case the last line is not empty
int line, column;
editor->convertPosition(endOfDoc, &line, &column);
const int positionInBlock = column - 1;
if (!editor->textAt(endOfDoc - positionInBlock, positionInBlock).simplified().isEmpty())
if (!editor->textAt(endOfDoc - column, column).simplified().isEmpty())
snippet = QLatin1Char('\n') + snippet;
editor->insert(snippet);