未验证 提交 1c768241 编写于 作者: J jslavitz 提交者: GitHub

entering a character with a selection deletes the selection (#6113)

上级 9fc355d2
......@@ -158,6 +158,9 @@ class InputConnectionAdaptor extends BaseInputConnection {
int character = event.getUnicodeChar();
if (character != 0) {
int selStart = Math.max(0, Selection.getSelectionStart(mEditable));
int selEnd = Selection.getSelectionEnd(mEditable);
if (selEnd != selStart)
mEditable.delete(selStart, selEnd);
mEditable.insert(selStart, String.valueOf((char) character));
setSelection(selStart + 1, selStart + 1);
updateEditingState();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册