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

Merged
merged 1 commit into from
Nov 26, 2024

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 2 times, most recently from bace10d to 64f1276 Compare June 17, 2024 15:18
@ima1zumi
Copy link
Member

@tompng I'm so sorry for the late response. Could you resolve conflicts?

@tompng tompng force-pushed the keystroke_handles_multibyte branch from 64f1276 to aae25da Compare November 24, 2024 17:43
@tompng tompng force-pushed the keystroke_handles_multibyte branch from aae25da to 279d16b Compare November 24, 2024 18:01
@tompng
Copy link
Member Author

tompng commented Nov 24, 2024

Rebase done

Copy link
Member

@ima1zumi ima1zumi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ima1zumi ima1zumi merged commit 5a8da85 into ruby:master Nov 26, 2024
44 of 46 checks passed
@tompng tompng deleted the keystroke_handles_multibyte branch November 26, 2024 18:01
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.

2 participants