Skip to content

Commit

Permalink
entering a character with a selection deletes the selection (flutter#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jslavitz authored Aug 30, 2018
1 parent 9fc355d commit 1c76824
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ public boolean sendKeyEvent(KeyEvent event) {
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();
Expand Down

0 comments on commit 1c76824

Please sign in to comment.