mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 00:54:01 +02:00

(https://github.com/ruby/reline/pull/709)
* Improve key binding match/matching check
* Rename key_actors to default_key_bindings
* Make key_stroke.expand always return a value
* Update add_default_key_binding to use a add_default_key_binding_by_keymap internally
Co-authored-by: Stan Lo <stan001212@gmail.com>
---------
353ec236e2
Co-authored-by: Stan Lo <stan001212@gmail.com>
17 lines
324 B
Ruby
17 lines
324 B
Ruby
class Reline::KeyActor::Composite
|
|
def initialize(key_actors)
|
|
@key_actors = key_actors
|
|
end
|
|
|
|
def matching?(key)
|
|
@key_actors.any? { |key_actor| key_actor.matching?(key) }
|
|
end
|
|
|
|
def get(key)
|
|
@key_actors.each do |key_actor|
|
|
func = key_actor.get(key)
|
|
return func if func
|
|
end
|
|
nil
|
|
end
|
|
end
|