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

Execute compress_meta_key if convert_meta is on #389

Merged
merged 2 commits into from
Dec 10, 2021

Conversation

ima1zumi
Copy link
Member

fix #357

When using 8-bit characters, it is better not to use compress_meta_key.
I believe not to use compress_meta_key unless set convert-meta on is written in the .inputrc.

The following is a quote from tmtm's comments.

The behavior of this compress_meta_key method is similar to the behavior of convert-meta=on in readline, but readline turns off convert-meta if the locale contains 8bit characters.

In readline(3):

convert-meta (On)
If set to On, readline will convert characters with the eighth
bit set to an ASCII key sequence by stripping the eighth bit and
prefixing it with an escape character (in effect, using escape
as the meta prefix). The default is On, but readline will set
it to Off if the locale contains eight-bit characters.

Co-authored-by: TOMITA Masahiro tommy@tmtm.org

fix `ruby#357`

When using 8-bit characters, it is better not to use `compress_meta_key`.
I believe not to use `compress_meta_key` unless `set convert-meta on` is written in the `.inputrc`.

The following is a quote from tmtm's comments.

> The behavior of this compress_meta_key method is similar to the behavior of convert-meta=on in readline, but readline turns off convert-meta if the locale contains 8bit characters.

> In readline(3):

> convert-meta (On)
> If set to On, readline will convert characters with the eighth
> bit set to an ASCII key sequence by stripping the eighth bit and
> prefixing it with an escape character (in effect, using escape
> as the meta prefix). The default is On, but readline will set
> it to Off if the locale contains eight-bit characters.

Co-authored-by: TOMITA Masahiro <tommy@tmtm.org>
@ima1zumi ima1zumi marked this pull request as draft November 23, 2021 10:48
@ima1zumi
Copy link
Member Author

After applying this branch, the document browsing function with Alt+D seems to stop working. 🤔
I'll think it over.

@ima1zumi
Copy link
Member Author

Added Alt+d keycode for not using convert_meta at ruby/irb#311.

@ima1zumi ima1zumi marked this pull request as ready for review November 29, 2021 13:11
@aycabta
Copy link
Member

aycabta commented Dec 2, 2021

Wow, this is the perfect solution to it, thank you @ima1zumi and @tmtm!

Copy link
Member

@aycabta aycabta left a comment

Choose a reason for hiding this comment

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

convert-meta (On)

(snip)

The default is On

Could you add the default value in initialize method of Reline::Config?

@aycabta aycabta mentioned this pull request Dec 2, 2021
If Reline::IOGate.encoding contains 7-bit characters, convert-meta will set it On.

Because in readline(3):

>  The default is On, but readline will set it to Off if the locale contains eight-bit characters.

As far as I know, 7-bit encoding used in terminals is only US-ASCII.
@aycabta aycabta merged commit ad67f02 into ruby:master Dec 10, 2021
@aycabta
Copy link
Member

aycabta commented Dec 10, 2021

Thank you!

@ima1zumi ima1zumi deleted the compress_meta_key-if-convert_meta-is-on branch December 10, 2021 13:49
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.

"①", "だ", "占" are not entered on 0.2.8.pre.8
2 participants