Fixed text editing for multi-byte characters.

This commit is contained in:
Aloshi 2014-08-30 15:37:51 -05:00
parent c4d0e0229e
commit 531fb50e01

View file

@ -60,12 +60,13 @@ void TextEditComponent::textInput(const char* text)
{
if(mCursor > 0)
{
mText.erase(mText.begin() + mCursor - 1, mText.begin() + mCursor);
mCursor--;
size_t newCursor = Font::getPrevCursor(mText, mCursor);
mText.erase(mText.begin() + newCursor, mText.begin() + mCursor);
mCursor = newCursor;
}
}else{
mText.insert(mCursor, text);
mCursor++;
mCursor += strlen(text);
}
}