diff options
-rw-r--r-- | ranger/container/keymap.py | 6 | ||||
-rw-r--r-- | ranger/gui/ui.py | 7 | ||||
-rw-r--r-- | test/tc_ui.py | 2 |
3 files changed, 7 insertions, 8 deletions
diff --git a/ranger/container/keymap.py b/ranger/container/keymap.py index dae8955a..e49da6ee 100644 --- a/ranger/container/keymap.py +++ b/ranger/container/keymap.py @@ -282,7 +282,7 @@ class KeyBuffer(object): break return self.command -key_map = { +special_keys = { 'dir': DIRKEY, 'any': ANYKEY, 'psv': PASSIVE_ACTION, @@ -303,7 +303,7 @@ key_map = { 'tab': ord('\t'), } for char in ascii_lowercase: - key_map['c-' + char] = ord(char) - 96 + special_keys['c-' + char] = ord(char) - 96 def translate_keys(obj): """ @@ -327,7 +327,7 @@ def translate_keys(obj): in_brackets = False string = ''.join(bracket_content).lower() try: - yield key_map[string] + yield special_keys[string] except KeyError: yield ord('<') for c in bracket_content: diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index eb7c26fa..a972eca9 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -144,16 +144,15 @@ class UI(DisplayableContainer): self.env.cmd = cmd - if hasattr(cmd, 'show_obj') and hasattr(cmd.show_obj, 'hint'): - if hasattr(self, 'hint'): - self.hint(cmd.show_obj.hint) - elif cmd.function: + if cmd.function: try: cmd.function(CommandArgs.from_widget(self)) except Exception as error: self.fm.notify(error) if kbuf.done: kbuf.clear() + else: + kbuf.clear() def get_next_key(self): """Waits for key input and returns the pressed key""" diff --git a/test/tc_ui.py b/test/tc_ui.py index affec907..98ddff93 100644 --- a/test/tc_ui.py +++ b/test/tc_ui.py @@ -28,7 +28,7 @@ class Test(unittest.TestCase): def setUp(self): self.fm = Fake() - self.ui = ui.UI(env=Fake(), fm=self.fm, commandlist=Fake()) + self.ui = ui.UI(env=Fake(), fm=self.fm, keymap=Fake()) def fakesetup(): self.ui.widget = Fake() |