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

Handle multibyte character input by KeyStroke #713

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tompng
Copy link
Member

@tompng tompng commented May 29, 2024

Depends on #712
Third step of #708

LineEditor was handling multibyte input with @multibyte_buffer. I think it should be done in keystroke recognizing layer.
We can handle multibyte character by :matching | :matched | :matching_matched mechanism just like other keystroke inputs.

Bug fix

When invalid byte is input to Reline, Reline does not respond to any key except arrow keys.

$ irb -Eus-ascii
irb(main):001> type something and then input multibyte character without using paste

You can not input anything because @multibyte_buffer never become a valid string.

This pull request considers invalid string as :matching_matched. It can be a broken string (:matched) and it can also be part of a valid multibyte character (:matching).
This way, if Reline doesn't receive next bytes within keyseq timeout, Reline can ignore the broken input bytes.

@tompng tompng force-pushed the keystroke_handles_multibyte branch 2 times, most recently from 8811a1d to b107274 Compare June 2, 2024 07:39
@tompng tompng force-pushed the keystroke_handles_multibyte branch 2 times, most recently from ca108f2 to 07facbb Compare June 5, 2024 04:19
@tompng tompng marked this pull request as ready for review June 5, 2024 04:27
@tompng tompng force-pushed the keystroke_handles_multibyte branch from 07facbb to bace10d Compare June 11, 2024 15:16
@tompng tompng force-pushed the keystroke_handles_multibyte branch from bace10d to 64f1276 Compare June 17, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant