mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
38ae3b8e36
commit
9e0caba187
2 changed files with 10 additions and 2 deletions
|
@ -16,7 +16,13 @@ module Reline
|
||||||
|
|
||||||
class ConfigEncodingConversionError < StandardError; end
|
class ConfigEncodingConversionError < StandardError; end
|
||||||
|
|
||||||
Key = Struct.new('Key', :char, :combined_char, :with_meta)
|
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)
|
||||||
|
end
|
||||||
|
end
|
||||||
CursorPos = Struct.new(:x, :y)
|
CursorPos = Struct.new(:x, :y)
|
||||||
DialogRenderInfo = Struct.new(:pos, :contents, :pointer, :bg_color, :width, :height, keyword_init: true)
|
DialogRenderInfo = Struct.new(:pos, :contents, :pointer, :bg_color, :width, :height, keyword_init: true)
|
||||||
|
|
||||||
|
|
|
@ -1480,7 +1480,9 @@ class Reline::LineEditor
|
||||||
@last_key = key
|
@last_key = key
|
||||||
@dialogs.each do |dialog|
|
@dialogs.each do |dialog|
|
||||||
# The dialog will intercept the key if trap_key is set.
|
# The dialog will intercept the key if trap_key is set.
|
||||||
return if dialog.trap_key and key.combined_char == dialog.trap_key
|
if dialog.trap_key and dialog.trap_key.match?(key)
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@just_cursor_moving = nil
|
@just_cursor_moving = nil
|
||||||
if key.char.nil?
|
if key.char.nil?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue