Skip to content

prompt() failing to handle deleting multi-byte characters #27283

@TunaFish2K

Description

@TunaFish2K

What version of Bun is running?

1.3.9+cf6cdbbba

What platform is your computer?

Linux 6.18.9-zen1-2-zen x86_64 unknowng

What steps can reproduce the bug?

call prompt():

const input = prompt();

in the shell, input mutli-byte character, for example, 笨蛋.

then, press backspace twice.

only '蛋' will be deleted.

after this, try continue pressing backspace.

you won't be able to delete the character.

What is the expected behavior?

call prompt():

const input = prompt();

in the shell, input mutli-byte character, for example, 笨蛋.

then, press backspace twice.

both characters should be deleted.

What do you see instead?

pressing once moves the cursor to the center of the delete character, twice delete the character.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions