laravel / prompts

Beautiful and user-friendly forms for your command-line PHP applications.
https://laravel.com/docs/prompts
MIT License
532 stars 94 forks source link

Fix for up/down arrows + cursor position when textarea content contains multi-byte strings #137

Closed joetannenbaum closed 6 months ago

joetannenbaum commented 7 months ago

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.