diff options
author | ima1zumi <mariimaizumi5@gmail.com> | 2021-12-06 23:26:38 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-12-10 22:19:14 +0900 |
commit | 5f1975a454dd9a6743bfa196111a4fde62366798 (patch) | |
tree | da734ed168901582d0c4cd9843fd0f31dd0c1c08 /lib/reline | |
parent | 519a945efcb0205bdf4085e32cc76e56610a45c0 (diff) |
[ruby/reline] @convert_meta is true unless 8-bit characters
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.
https://github.com/ruby/reline/commit/b71d1fa496
Diffstat (limited to 'lib/reline')
-rw-r--r-- | lib/reline/config.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/reline/config.rb b/lib/reline/config.rb index 4b2655d8eb..5ef5ce4e8d 100644 --- a/lib/reline/config.rb +++ b/lib/reline/config.rb @@ -67,6 +67,7 @@ class Reline::Config @keyseq_timeout = 500 @test_mode = false @autocompletion = false + @convert_meta = true if seven_bit_encoding?(Reline::IOGate.encoding) end def reset @@ -387,4 +388,8 @@ class Reline::Config end ret end + + private def seven_bit_encoding?(encoding) + encoding == Encoding::US_ASCII + end end |