[poincare/utf8_decoder] nextCodePointPointer is now stringPosition

This commit is contained in:
Léa Saviot
2019-01-18 10:29:10 +01:00
committed by Émilie Feral
parent 66898b207a
commit f90e709201
7 changed files with 16 additions and 22 deletions

View File

@@ -11,8 +11,8 @@ int CursorIndexInCommandText(const char * text) {
UTF8Decoder decoder(text);
size_t index = 0;
const char * currentPointer = text;
const char * nextPointer = decoder.nextCodePointPointer();
CodePoint codePoint = decoder.nextCodePoint();
const char * nextPointer = decoder.stringPosition();
while (codePoint != KDCodePointNull) {
if (codePoint == '(' || codePoint == '\'') {
return index + 1;
@@ -22,8 +22,8 @@ int CursorIndexInCommandText(const char * text) {
}
index+= nextPointer - currentPointer;
currentPointer = nextPointer;
nextPointer = decoder.nextCodePointPointer();
codePoint = decoder.nextCodePoint();
nextPointer = decoder.stringPosition();
}
return index;
}