summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/reline.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/reline.rb b/lib/reline.rb
index 735a5afad8..4b06d07b4d 100644
--- a/lib/reline.rb
+++ b/lib/reline.rb
@@ -18,9 +18,21 @@ module Reline
Key = Struct.new('Key', :char, :combined_char, :with_meta) do
def match?(key)
- (key.char.nil? or char.nil? or char == key.char) and
- (key.combined_char.nil? or combined_char.nil? or combined_char == key.combined_char) and
- (key.with_meta.nil? or with_meta.nil? or with_meta == key.with_meta)
+ if key.instance_of?(Reline::Key)
+ (key.char.nil? or char.nil? or char == key.char) and
+ (key.combined_char.nil? or combined_char.nil? or combined_char == key.combined_char) and
+ (key.with_meta.nil? or with_meta.nil? or with_meta == key.with_meta)
+ elsif key.is_a?(Integer)
+ if not combined_char.nil? and combined_char == key
+ true
+ elsif not char.nil? and char == key
+ true
+ else
+ false
+ end
+ else
+ false
+ end
end
end
CursorPos = Struct.new(:x, :y)