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

Multi-byte characters make the right border position incorrect #29

Closed
crazywhalecc opened this issue Aug 2, 2023 · 3 comments · Fixed by #33
Closed

Multi-byte characters make the right border position incorrect #29

crazywhalecc opened this issue Aug 2, 2023 · 3 comments · Fixed by #33
Assignees
Labels

Comments

@crazywhalecc
Copy link
Contributor

crazywhalecc commented Aug 2, 2023

Laravel Prompts Version

v0.1.1 (I also tested dev-main)

Laravel Version

Independent installation of prompts

PHP Version

8.2.8

Operating System & Version

macOS 13.0

Terminal Application

Terminal

Description

When I input multi-byte characters (such as Chinese, Japanese, Emoji, etc.), the width of the border at the end changes. These multibyte characters occupy 2 spaces, but the calculation boundary may use its actual length (3 spaces).

Maybe using mb_strwidth to solve this?

Steps To Reproduce

image image
@jessarcher
Copy link
Member

jessarcher commented Aug 2, 2023

Hey @crazywhalecc,

TIL about mb_strwidth! Thank you! I've been using mb_strlen, which works fine for single-width multibyte characters like accents, but not emojis, etc.

I'll have a play around and hopefully get something together very soon.

@jessarcher jessarcher self-assigned this Aug 2, 2023
@jessarcher jessarcher added the bug label Aug 2, 2023
@tyler36
Copy link
Contributor

tyler36 commented Aug 3, 2023

Came across this using Japanese with Prompt 0.1.3 on WSL.

prompt

@jessarcher
Copy link
Member

Continuing the discussion over at #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants