mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-07 19:06:39 +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,
|
text.insert(m_boxes[m_caret].from,
|
||||||
base::to_utf8(unicodeStr));
|
base::to_utf8(unicodeStr));
|
||||||
|
recalcCharBoxes(text);
|
||||||
++m_caret;
|
++m_caret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,7 +627,7 @@ void Entry::executeCmd(EntryCmd cmd, int unicodeChar, bool shift_pressed)
|
|||||||
else
|
else
|
||||||
m_select = -1;
|
m_select = -1;
|
||||||
|
|
||||||
m_caret = text.size();
|
m_caret = lastCaretPos();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EntryCmd::DeleteForward:
|
case EntryCmd::DeleteForward:
|
||||||
|
Loading…
Reference in New Issue
Block a user