forked from qt-creator/qt-creator
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:
@@ -378,7 +378,7 @@ void Manager::gotoLocations(const QList<QVariant> &list)
|
|||||||
int line;
|
int line;
|
||||||
int column;
|
int column;
|
||||||
textEditor->convertPosition(textEditor->position(), &line, &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) {
|
if (auto it = locations.constFind(current), end = locations.constEnd(); it != end) {
|
||||||
// we already are at the symbol, cycle to next location
|
// we already are at the symbol, cycle to next location
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
|
|||||||
|
|
||||||
// find the beginning of a filename
|
// find the beginning of a filename
|
||||||
QString buffer;
|
QString buffer;
|
||||||
int beginPos = column - 1;
|
int beginPos = column;
|
||||||
while (beginPos >= 0) {
|
while (beginPos >= 0) {
|
||||||
if (isValidFileNameChar(block, beginPos)) {
|
if (isValidFileNameChar(block, beginPos)) {
|
||||||
buffer.prepend(block.at(beginPos));
|
buffer.prepend(block.at(beginPos));
|
||||||
|
|||||||
@@ -414,6 +414,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
|
|||||||
} else {
|
} else {
|
||||||
currentTextEditor->convertPosition(targetTestFile->m_targetCursorPosition,
|
currentTextEditor->convertPosition(targetTestFile->m_targetCursorPosition,
|
||||||
&expectedLine, &expectedColumn);
|
&expectedLine, &expectedColumn);
|
||||||
|
++expectedColumn;
|
||||||
if (useClangd && (tag == "classDestructor" || tag == "fromDestructorDefinitionSymbol"
|
if (useClangd && (tag == "classDestructor" || tag == "fromDestructorDefinitionSymbol"
|
||||||
|| tag == "fromDestructorBody")) {
|
|| tag == "fromDestructorBody")) {
|
||||||
--expectedColumn; // clangd goes before the ~, built-in code model after
|
--expectedColumn; // clangd goes before the ~, built-in code model after
|
||||||
|
|||||||
@@ -357,8 +357,7 @@ void QmakeProjectManagerPluginPrivate::addLibraryImpl(const FilePath &filePath,
|
|||||||
// add extra \n in case the last line is not empty
|
// add extra \n in case the last line is not empty
|
||||||
int line, column;
|
int line, column;
|
||||||
editor->convertPosition(endOfDoc, &line, &column);
|
editor->convertPosition(endOfDoc, &line, &column);
|
||||||
const int positionInBlock = column - 1;
|
if (!editor->textAt(endOfDoc - column, column).simplified().isEmpty())
|
||||||
if (!editor->textAt(endOfDoc - positionInBlock, positionInBlock).simplified().isEmpty())
|
|
||||||
snippet = QLatin1Char('\n') + snippet;
|
snippet = QLatin1Char('\n') + snippet;
|
||||||
|
|
||||||
editor->insert(snippet);
|
editor->insert(snippet);
|
||||||
|
|||||||
Reference in New Issue
Block a user