forked from qt-creator/qt-creator
TextEditor: move convenience from texteditor to utils
Allows to use this header without texteditor dependency. Change-Id: I706f42799c3ea42473a716fa9ef9f3cfbef6fdd4 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -42,7 +42,6 @@
|
||||
#include <texteditor/codeassist/assistproposalitem.h>
|
||||
#include <texteditor/codeassist/functionhintproposal.h>
|
||||
#include <texteditor/codeassist/ifunctionhintproposalmodel.h>
|
||||
#include <texteditor/convenience.h>
|
||||
|
||||
#include <cplusplus/BackwardsScanner.h>
|
||||
#include <cplusplus/ExpressionUnderCursor.h>
|
||||
@@ -52,6 +51,7 @@
|
||||
#include <clangsupport/filecontainer.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/textutils.h>
|
||||
#include <utils/mimetypes/mimedatabase.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -556,10 +556,7 @@ ClangCompletionAssistProcessor::extractLineColumn(int position)
|
||||
return {-1, -1};
|
||||
|
||||
int line = -1, column = -1;
|
||||
TextEditor::Convenience::convertPosition(m_interface->textDocument(),
|
||||
position,
|
||||
&line,
|
||||
&column);
|
||||
::Utils::Text::convertPosition(m_interface->textDocument(), position, &line, &column);
|
||||
const QTextBlock block = m_interface->textDocument()->findBlock(position);
|
||||
column += ClangCodeModel::Utils::extraUtf8CharsShift(block.text(), column) + 1;
|
||||
return {line, column};
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
#include <cpptools/cpptoolsconstants.h>
|
||||
|
||||
#include <texteditor/convenience.h>
|
||||
#include <texteditor/fontsettings.h>
|
||||
#include <texteditor/textdocument.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
|
||||
#include <utils/textutils.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/proxyaction.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -176,7 +176,7 @@ void addErrorSelections(const QVector<ClangBackEnd::DiagnosticContainer> &diagno
|
||||
ClangBackEnd::SourceLocationContainer toSourceLocation(QTextDocument *textDocument, int position)
|
||||
{
|
||||
int line, column;
|
||||
if (TextEditor::Convenience::convertPosition(textDocument, position, &line, &column))
|
||||
if (Utils::Text::convertPosition(textDocument, position, &line, &column))
|
||||
return ClangBackEnd::SourceLocationContainer(Utf8String(), line, column);
|
||||
|
||||
return ClangBackEnd::SourceLocationContainer();
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
#include <cpptools/cppworkingcopy.h>
|
||||
#include <cpptools/editordocumenthandle.h>
|
||||
|
||||
#include <texteditor/convenience.h>
|
||||
#include <texteditor/displaysettings.h>
|
||||
#include <texteditor/fontsettings.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
@@ -56,6 +55,7 @@
|
||||
|
||||
#include <cplusplus/CppDocument.h>
|
||||
|
||||
#include <utils/textutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/runextensions.h>
|
||||
|
||||
@@ -253,10 +253,8 @@ void ClangEditorDocumentProcessor::updateHighlighting(
|
||||
static int currentLine(const TextEditor::AssistInterface &assistInterface)
|
||||
{
|
||||
int line, column;
|
||||
TextEditor::Convenience::convertPosition(assistInterface.textDocument(),
|
||||
assistInterface.position(),
|
||||
&line,
|
||||
&column);
|
||||
::Utils::Text::convertPosition(assistInterface.textDocument(), assistInterface.position(),
|
||||
&line, &column);
|
||||
return line;
|
||||
}
|
||||
|
||||
@@ -322,10 +320,10 @@ static QFuture<CppTools::CursorInfo> defaultCursorInfoFuture()
|
||||
|
||||
static bool convertPosition(const QTextCursor &textCursor, int *line, int *column)
|
||||
{
|
||||
const bool converted = TextEditor::Convenience::convertPosition(textCursor.document(),
|
||||
textCursor.position(),
|
||||
line,
|
||||
column);
|
||||
const bool converted = ::Utils::Text::convertPosition(textCursor.document(),
|
||||
textCursor.position(),
|
||||
line,
|
||||
column);
|
||||
QTC_CHECK(converted);
|
||||
return converted;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
#include "clangeditordocumentprocessor.h"
|
||||
#include "clangfollowsymbol.h"
|
||||
|
||||
#include <texteditor/convenience.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
|
||||
#include <clangsupport/highlightingmarkcontainer.h>
|
||||
|
||||
#include <utils/textutils.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
namespace ClangCodeModel {
|
||||
@@ -104,9 +104,9 @@ TextEditor::TextEditorWidget::Link ClangFollowSymbol::findLink(
|
||||
bool)
|
||||
{
|
||||
int lineNumber = 0, positionInBlock = 0;
|
||||
QTextCursor cursor = TextEditor::Convenience::wordStartCursor(data.cursor());
|
||||
TextEditor::Convenience::convertPosition(cursor.document(), cursor.position(), &lineNumber,
|
||||
&positionInBlock);
|
||||
QTextCursor cursor = Utils::Text::wordStartCursor(data.cursor());
|
||||
Utils::Text::convertPosition(cursor.document(), cursor.position(), &lineNumber,
|
||||
&positionInBlock);
|
||||
|
||||
const uint line = lineNumber;
|
||||
const uint column = positionInBlock + 1;
|
||||
|
||||
Reference in New Issue
Block a user