From 79652c58734be2d9d2055cbbe076e952fa7978a1 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 6 Sep 2021 04:20:08 +0900 Subject: [PATCH] [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 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)