diff options
author | aycabta <aycabta@gmail.com> | 2021-09-06 04:20:08 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-09-06 05:24:05 +0900 |
commit | 79652c58734be2d9d2055cbbe076e952fa7978a1 (patch) | |
tree | ba19a83f17ce3e699f1d26733dea865bee296fb8 /lib/reline/line_editor.rb | |
parent | d07060c42a7d3fd1ff9a3024e5f064448578a722 (diff) | |
download | ruby-79652c58734be2d9d2055cbbe076e952fa7978a1.tar.gz |
[ruby/reline] Support multiple trap_key
https://github.com/ruby/reline/commit/b0207fa049
Diffstat (limited to 'lib/reline/line_editor.rb')
-rw-r--r-- | lib/reline/line_editor.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index c2ef1970c1..360106621f 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -578,7 +578,11 @@ class Reline::LineEditor @proc_scope.set_key(key) dialog_render_info = @proc_scope.call if @trap_key - if @trap_key.is_a?(Array) + if @trap_key.any?{ |i| i.is_a?(Array) } # multiple trap + @trap_key.each do |t| + @config.add_oneshot_key_binding(t, @name) + end + elsif @trap_key.is_a?(Array) @config.add_oneshot_key_binding(@trap_key, @name) elsif @trap_key.is_a?(Integer) or @trap_key.is_a?(Reline::Key) @config.add_oneshot_key_binding([@trap_key], @name) |