提交 bce223c0 编写于 作者: J Jason Simmons 提交者: GitHub

Set the initial selection range when creating an InputConnection (#3127)

Fixes https://github.com/flutter/flutter/issues/6152
上级 cf774d58
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册