diff options
author | ima1zumi <mariimaizumi5@gmail.com> | 2021-11-22 21:16:20 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-12-10 22:19:14 +0900 |
commit | 519a945efcb0205bdf4085e32cc76e56610a45c0 (patch) | |
tree | ff67688ac49802a36fdede27604f8c87c9a7384a /lib/reline/key_stroke.rb | |
parent | 3a2ae5bb19a653ac131136c6bf9a7550f64804f6 (diff) | |
download | ruby-519a945efcb0205bdf4085e32cc76e56610a45c0.tar.gz |
[ruby/reline] Execute compress_meta_key if convert_meta is on
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.
https://github.com/ruby/reline/commit/9491cc8542
Co-authored-by: TOMITA Masahiro <tommy@tmtm.org>
Diffstat (limited to 'lib/reline/key_stroke.rb')
-rw-r--r-- | lib/reline/key_stroke.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/reline/key_stroke.rb b/lib/reline/key_stroke.rb index 16e5f69914..c1c61513a9 100644 --- a/lib/reline/key_stroke.rb +++ b/lib/reline/key_stroke.rb @@ -4,6 +4,7 @@ class Reline::KeyStroke end def compress_meta_key(ary) + return ary unless @config.convert_meta ary.inject([]) { |result, key| if result.size > 0 and result.last == "\e".ord result[result.size - 1] = Reline::Key.new(key, key | 0b10000000, true) |