diff --git a/escher/src/text_field.cpp b/escher/src/text_field.cpp index 5c76859ff..98d50fb20 100644 --- a/escher/src/text_field.cpp +++ b/escher/src/text_field.cpp @@ -99,7 +99,7 @@ void TextField::appendText(const char * text) { if (m_currentTextLength + textSize > m_textBufferSize) { return; } - for (int k = m_currentTextLength; k > m_currentCursorPosition - 1; k--) { + for (int k = m_currentTextLength; k >= m_currentCursorPosition && k >= 0; k--) { m_textBuffer[k+textSize] = m_textBuffer[k]; } strlcpy(&m_textBuffer[m_currentCursorPosition], text, textSize);