Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix maxLength of composed character on EditBox #1798

Merged
merged 1 commit into from Aug 21, 2019
Merged

Conversation

@PPpro
Copy link
Contributor

@PPpro PPpro commented Aug 21, 2019

Re: cocos-creator/2d-tasks#1700
相关论坛反馈:
https://forum.cocos.com/t/editbox-bug/81979

changeLog:

  • 修复 EditBox 输入 emoj 时,字符串截取失败的问题

因为 emoj 占用不止一个字节,可能会被截取掉一半,所以在截取之前,应该先拿到可截取的 index

1

修复后:
2

@PPpro PPpro changed the title fix composed character on EditBox fix maxLength of composed character on EditBox Aug 21, 2019
@minggo
Copy link
Contributor

@minggo minggo commented Aug 21, 2019

这个修改没什么问题。但是为什么论坛里说是会崩溃呢?不应该只是被截断吗?

Loading

@PPpro
Copy link
Contributor Author

@PPpro PPpro commented Aug 21, 2019

因为转 utf8string 的时候返回 NULL 了,所以会导致程序崩溃 @minggo

Loading

@minggo minggo merged commit 0474920 into cocos-creator:v2.1.3 Aug 21, 2019
1 check failed
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants