Fix composed character on multiline EditBox (#11263)

Co-authored-by: pandamicro <lphuabin@gmail.com>
This commit is contained in:
听榆大叔
2022-11-24 09:46:16 +08:00
committed by GitHub
parent 06578c3091
commit e1c86d668b
+4 -2
View File
@@ -222,8 +222,10 @@ void onParentViewTouched(const cc::CustomEvent &touchEvent){
return;
// check length limit after text changed, a little rude
if (textView.text.length > g_maxLength)
textView.text = [textView.text substringToIndex:g_maxLength];
if (textView.text.length > g_maxLength) {
NSRange rangeIndex = [textView.text rangeOfComposedCharacterSequenceAtIndex:g_maxLength];
textView.text = [textView.text substringToIndex:rangeIndex.location];
}
tViewOnView.text = textView.text;
tViewOnToolbar.text = textView.text;
callJSFunc("input", [textView.text UTF8String]);