diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java index 4f2088fdf7..2e099e9772 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java @@ -141,6 +141,14 @@ class InputConnectionAdaptor extends BaseInputConnection { Selection.setSelection(mEditable, selStart - 1); deleteSurroundingText(0, 1); } + } else if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_LEFT) { + int selStart = Selection.getSelectionStart(mEditable); + int newSel = Math.max(selStart - 1, 0); + setSelection(newSel, newSel); + } else if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_RIGHT) { + int selStart = Selection.getSelectionStart(mEditable); + int newSel = Math.min(selStart + 1, mEditable.length()); + setSelection(newSel, newSel); } else { // Enter a character. int character = event.getUnicodeChar();