提交 5b51394b 编写于 作者: C Chris Bracken 提交者: GitHub

Handle Unicode surrogates in FlutterTextInputView (#3557)

* Handle Unicode surrogates in FlutterTextInputView

Fixes a bug introduced in 38664ac3.
上级 878f0ff0
......@@ -113,11 +113,15 @@ static UIKeyboardType ToUIKeyboardType(NSString* inputType) {
int start = std::max(0, std::min(_selectionBase, _selectionExtent));
int end = std::max(0, std::max(_selectionBase, _selectionExtent));
int len = end - start;
if (len == 0 && start > 0) {
if (len > 0) {
NSRange selRange = [self.text
rangeOfComposedCharacterSequencesForRange:NSMakeRange(start, len)];
[self.text deleteCharactersInRange:selRange];
} else if (start > 0) {
start -= 1;
len = 1;
NSRange charRange = [self.text rangeOfComposedCharacterSequenceAtIndex:start];
[self.text deleteCharactersInRange:charRange];
}
[self.text deleteCharactersInRange:NSMakeRange(start, len)];
_selectionBase = start;
_selectionExtent = start;
_selectionAffinity = _kTextAffinityDownstream;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册