lib/textbringer/controller.rb in textbringer-1.1.1 vs lib/textbringer/controller.rb in textbringer-1.1.2
- old
+ new
@@ -53,11 +53,19 @@
break if c.nil?
Window.echo_area.clear_message
@last_key = c
@key_sequence << @last_key
cmd = key_binding(@key_sequence)
- if cmd.is_a?(Symbol) || cmd.respond_to?(:call)
+ if cmd.nil?
+ keys = Keymap.key_sequence_string(@key_sequence)
+ @key_sequence.clear
+ @prefix_arg = nil
+ message("#{keys} is undefined")
+ Window.beep
+ elsif cmd.is_a?(Keymap)
+ # multi-stroke key binding?
+ else
@this_command_keys = @key_sequence
@key_sequence = []
@this_command = cmd
@current_prefix_arg = @prefix_arg
@prefix_arg = nil
@@ -70,16 +78,9 @@
end
ensure
run_hooks(:post_command_hook, remove_on_error: true)
@last_command = @this_command
@this_command = nil
- end
- else
- if cmd.nil?
- keys = Keymap.key_sequence_string(@key_sequence)
- @key_sequence.clear
- @prefix_arg = nil
- message("#{keys} is undefined")
end
end
Window.redisplay
rescue Exception => e
show_exception(e)