-
Notifications
You must be signed in to change notification settings - Fork 83
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
Refactor Reline::Unicode ed_ vi_ em_ split_by_width methods #720
base: master
Are you sure you want to change the base?
Conversation
789d090
to
85f4405
Compare
lib/reline/unicode.rb
Outdated
end | ||
[byte_size, width, new_str] | ||
gcs = line.byteslice(byte_pointer..).grapheme_clusters | ||
nonwords = gcs.take_while { |c| c.encode(Encoding::UTF_8).match?(/\P{Word}/) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to encode gcs
all at once before looping through them?
Also, all tests still pass even if I removed these encoding calls. Can we add a few cases for them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encode
will change bytesize, so I have to fix all encode(Encoding::UTF_8).grapheme_clusters
in this file to return the correct bytesize in original encoding. I'll also add a test.
2f519c3
to
3365ab0
Compare
Depend on #759 (split some commits to it)
Refactor Reline::Unicode vi_ ed_ em_ methods
Rewrite them with -250 lines.
Update questionable test case.
Performance