ruby-changes:67622
From: aycabta <ko1@a...>
Date: Mon, 6 Sep 2021 05:24:18 +0900 (JST)
Subject: [ruby-changes:67622] 79652c5873 (master): [ruby/reline] Support multiple trap_key
https://git.ruby-lang.org/ruby.git/commit/?id=79652c5873 From 79652c58734be2d9d2055cbbe076e952fa7978a1 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Mon, 6 Sep 2021 04:20:08 +0900 Subject: [ruby/reline] Support multiple trap_key https://github.com/ruby/reline/commit/b0207fa049 --- lib/reline/line_editor.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index c2ef197..3601066 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -578,7 +578,11 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L578 @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) -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/