diff options
Diffstat (limited to 'src/plugins/clangcodemodel/clangutils.cpp')
-rw-r--r-- | src/plugins/clangcodemodel/clangutils.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/clangcodemodel/clangutils.cpp b/src/plugins/clangcodemodel/clangutils.cpp index cf659ff404..30dbbe7b10 100644 --- a/src/plugins/clangcodemodel/clangutils.cpp +++ b/src/plugins/clangcodemodel/clangutils.cpp @@ -190,5 +190,15 @@ void setLastSentDocumentRevision(const QString &filePath, uint revision) document->sendTracker().setLastSentRevision(int(revision)); } +int clangColumn(const QString &lineText, int cppEditorColumn) +{ + // (1) cppEditorColumn is the actual column shown by CppEditor. + // (2) The return value is the column in Clang which is the utf8 byte offset from the beginning + // of the line. + // Here we convert column from (1) to (2). + // '+ 1' is for 1-based columns + return lineText.left(cppEditorColumn).toUtf8().size() + 1; +} + } // namespace Utils } // namespace Clang |