diff --git a/es-core/src/components/TextEditComponent.cpp b/es-core/src/components/TextEditComponent.cpp index e729da09a..aedb7cff8 100644 --- a/es-core/src/components/TextEditComponent.cpp +++ b/es-core/src/components/TextEditComponent.cpp @@ -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); } }