mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
entering a character with a selection deletes the selection (flutter/engine#6113)
This commit is contained in:
parent
9c3f354418
commit
6638f518c6
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user