mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Set the initial selection range when creating an InputConnection (#3127)
Fixes https://github.com/flutter/flutter/issues/6152
This commit is contained in:
parent
cf774d580c
commit
bce223c0a6
@ -70,11 +70,16 @@ public class KeyboardViewState {
|
||||
outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE;
|
||||
InputConnectionAdaptor connection = new InputConnectionAdaptor(mView, mClient);
|
||||
if (mIncomingState != null) {
|
||||
outAttrs.initialSelStart = mIncomingState.selectionBase;
|
||||
outAttrs.initialSelEnd = mIncomingState.selectionExtent;
|
||||
connection.getEditable().append(mIncomingState.text);
|
||||
connection.setSelection(mIncomingState.selectionBase,
|
||||
mIncomingState.selectionExtent);
|
||||
connection.setComposingRegion(mIncomingState.composingBase,
|
||||
mIncomingState.composingExtent);
|
||||
} else {
|
||||
outAttrs.initialSelStart = 0;
|
||||
outAttrs.initialSelEnd = 0;
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user