Skip to content

Handle multibyte character input by KeyStroke - #713

Merged
ima1zumi merged 1 commit into
ruby:masterfrom
tompng:keystroke_handles_multibyte
Nov 26, 2024
Merged

ima1zumi merged 1 commit into
ruby:masterfrom
tompng:keystroke_handles_multibyte

Conversation

@tompng

@tompng tompng commented May 29, 2024 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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

tompng commented Nov 24, 2024

Copy link
Copy Markdown
Member Author

Rebase done

@ima1zumi ima1zumi left a comment

Copy link
Copy Markdown
Member

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
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants