forked from qt-creator/qt-creator
Clang: make workaround for multibyte utf8
Correct columns in clang diagnostics and completion Task-number: QTCREATORBUG-16775 Change-Id: I7260a0e52007fe261e83492dca5d457c34476497 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "clangdiagnosticfilter.h"
|
||||
#include "clangdiagnosticmanager.h"
|
||||
#include "clangisdiagnosticrelatedtolocation.h"
|
||||
#include "clangutils.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
@@ -60,9 +61,11 @@ QTextEdit::ExtraSelection createExtraSelections(const QTextCharFormat &mainforma
|
||||
int positionInText(QTextDocument *textDocument,
|
||||
const ClangBackEnd::SourceLocationContainer &sourceLocationContainer)
|
||||
{
|
||||
auto textBlock = textDocument->findBlockByNumber(int(sourceLocationContainer.line()) - 1);
|
||||
|
||||
return textBlock.position() + int(sourceLocationContainer.column()) - 1;
|
||||
auto textBlock = textDocument->findBlockByNumber(
|
||||
static_cast<int>(sourceLocationContainer.line()) - 1);
|
||||
int column = static_cast<int>(sourceLocationContainer.column()) - 1;
|
||||
column -= ClangCodeModel::Utils::extraUtf8CharsShift(textBlock.text(), column);
|
||||
return textBlock.position() + column;
|
||||
}
|
||||
|
||||
void addRangeSelections(const ClangBackEnd::DiagnosticContainer &diagnostic,
|
||||
|
||||
Reference in New Issue
Block a user