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 for up/down arrows + cursor position when textarea content contains multi-byte strings #137

Merged

Conversation

joetannenbaum
Copy link
Contributor

This PR is a fix for #133.

When the content of the textarea contains a multi-byte string, we need to count the characters in the content, not measure the width of the string to determine the cursor position.

By using count(mb_str_split($content)) instead of mb_strwidth($content), we are able to more accurately place the cursor where it belongs whether or not the content contains multi-byte strings.

src/TextareaPrompt.php Outdated Show resolved Hide resolved
@jessarcher jessarcher marked this pull request as draft April 17, 2024 07:27
@jessarcher jessarcher marked this pull request as ready for review April 17, 2024 23:12
@taylorotwell taylorotwell merged commit bf9a360 into laravel:main Apr 18, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect cursor position when text area contains multi-byte strings
3 participants