lib/textbringer/controller.rb in textbringer-0.1.7 vs lib/textbringer/controller.rb in textbringer-0.1.8

- old
+ new

@@ -5,11 +5,11 @@ RECURSIVE_EDIT_TAG = Object.new class Controller attr_accessor :this_command, :last_command, :overriding_map attr_accessor :prefix_arg, :current_prefix_arg - attr_reader :last_key, :recursive_edit_level + attr_reader :key_sequence, :last_key, :recursive_edit_level @@current = nil def self.current @@current @@ -112,27 +112,19 @@ case key when Symbol "<#{key}>" when "\e" "ESC" - when "\n" + when "\C-m" "RET" when /\A[\0-\b\v-\x1f\x7f]\z/ "C-" + (key.ord ^ 0x40).chr.downcase else key.to_s end end - private - - def key_binding(key_sequence) - @overriding_map&.lookup(key_sequence) || - Buffer.current&.keymap&.lookup(key_sequence) || - GLOBAL_MAP.lookup(key_sequence) - end - def echo_input if @prefix_arg || !@key_sequence.empty? if !@echo_immediately return if wait_input(1000) end @@ -154,8 +146,16 @@ Window.current.window.noutrefresh Window.update else @echo_immediately = false end + end + + private + + def key_binding(key_sequence) + @overriding_map&.lookup(key_sequence) || + Buffer.current&.keymap&.lookup(key_sequence) || + GLOBAL_MAP.lookup(key_sequence) end end end