Skip to content

Commit

Permalink
[ruby/reline] Support multiple trap_key
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta authored and matzbot committed Sep 5, 2021
1 parent d07060c commit 79652c5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/reline/line_editor.rb
Expand Up @@ -578,7 +578,11 @@ def call(key)
@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)
Expand Down

0 comments on commit 79652c5

Please sign in to comment.