mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-06 06:58:15 +00:00
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:
parent
aa93666481
commit
dede3610f3
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user