C++: TranslationUnit::getPosition takes utf16char offsets

...and not byte offsets anymore. This is necessary in order to calculate
the line and column numbers correctly with respect to unicode code
points.

Change-Id: I5d79857b3eaefeb8d563b4f1e3938a64debc5e08
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2014-05-06 14:48:24 -04:00
parent 70122b3061
commit 587eb49c4e
11 changed files with 359 additions and 77 deletions

View File

@@ -238,7 +238,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti
} else {
// Position the cursor on the token
unsigned line, column;
translationUnit->getPosition(token.bytesBegin(), &line, &column);
translationUnit->getPosition(token.utf16charsBegin(), &line, &column);
editor->gotoLine(line, column - 1);
QApplication::processEvents();
@@ -293,7 +293,7 @@ void TestActionsTestCase::moveWordCamelCaseToToken(TranslationUnit *translationU
QVERIFY(editorWidget);
unsigned line, column;
translationUnit->getPosition(token.bytesBegin(), &line, &column);
translationUnit->getPosition(token.utf16charsBegin(), &line, &column);
while (editor->currentLine() < (int) line
|| (editor->currentLine() == (int) line