forked from qt-creator/qt-creator
Utils: Move common positionInText function to Utils::Text
Change-Id: I5d74a73058ca457b0fb3f13eaf945f224d5699fb Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -205,20 +205,16 @@ void ClangEditorDocumentProcessor::updateCodeWarnings(
|
||||
}
|
||||
namespace {
|
||||
|
||||
int positionInText(QTextDocument *textDocument,
|
||||
const ClangBackEnd::SourceLocationContainer &sourceLocationContainer)
|
||||
{
|
||||
auto textBlock = textDocument->findBlockByNumber(int(sourceLocationContainer.line) - 1);
|
||||
|
||||
return textBlock.position() + int(sourceLocationContainer.column) - 1;
|
||||
}
|
||||
|
||||
TextEditor::BlockRange
|
||||
toTextEditorBlock(QTextDocument *textDocument,
|
||||
const ClangBackEnd::SourceRangeContainer &sourceRangeContainer)
|
||||
{
|
||||
return TextEditor::BlockRange(positionInText(textDocument, sourceRangeContainer.start),
|
||||
positionInText(textDocument, sourceRangeContainer.end));
|
||||
return TextEditor::BlockRange(::Utils::Text::positionInText(textDocument,
|
||||
sourceRangeContainer.start.line,
|
||||
sourceRangeContainer.start.column),
|
||||
::Utils::Text::positionInText(textDocument,
|
||||
sourceRangeContainer.end.line,
|
||||
sourceRangeContainer.end.column));
|
||||
}
|
||||
|
||||
QList<TextEditor::BlockRange>
|
||||
|
||||
Reference in New Issue
Block a user