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

Refactor utf-8 strings and invalid strings in test code #800

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tompng
Copy link
Member

@tompng tompng commented Jan 1, 2025

This pull request resolves the problem mentioned in the source code comment in input_keys.

def input_keys(input, convert = true)
   # Reline does not support convert-meta, but test data includes \M-char. It should be converted to ESC+char.
   # Note that mixing unicode chars and \M-char is not recommended. "\M-C\M-\C-A" is a single unicode character.
   ...
end

"\M-[char]" should be removed from test code because it is an invalid byte sequence string.
Reline only accepts "\e[char]" which is sent by Meta-[char] key input in modern terminal emulators.

After invalid byte sequence are removed, we don't need convert option in method input_keys because valid strings does not need to skip convert.

Other changes

def convert_str(input) can be simpler.
If the input needs unicode_normalize before conversion, then the prerequisites of the test (input unicode-unnormalized text) are broken. We just need to omit the test if the test encoding is not utf-8.

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