Fix bug inserting the first char in a text entry

If a text field (ui::Entry) contains text with length=1 (e.g. the number
"8"), and we focus and press that same char ("8"), the caret will be in
the position 0 with text "8" (the caret should be in position 1). this
patch fix this behavior.
This commit is contained in:
David Capello 2017-10-03 14:45:53 -03:00
parent aa93666481
commit dede3610f3

View File

@ -559,6 +559,7 @@ void Entry::executeCmd(EntryCmd cmd, int unicodeChar, bool shift_pressed)
text.insert(m_boxes[m_caret].from,
base::to_utf8(unicodeStr));
recalcCharBoxes(text);
++m_caret;
}
@ -626,7 +627,7 @@ void Entry::executeCmd(EntryCmd cmd, int unicodeChar, bool shift_pressed)
else
m_select = -1;
m_caret = text.size();
m_caret = lastCaretPos();
break;
case EntryCmd::DeleteForward: