diff --git a/alot/commands/globals.py b/alot/commands/globals.py index aa1fd4368..b1b90dff3 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -684,7 +684,7 @@ def apply(self, ui): linewidgets.append(line) body = urwid.ListBox(linewidgets) - titletext = 'Bindings Help (escape cancels)' + titletext = 'Bindings Help (%s cancels)' % settings.help_cancel_key box = DialogBox(body, titletext, bodyattr=text_att, @@ -694,7 +694,7 @@ def apply(self, ui): overlay = urwid.Overlay(box, ui.root_widget, 'center', ('relative', 70), 'middle', ('relative', 70)) - ui.show_as_root_until_keypress(overlay, 'esc') + ui.show_as_root_until_keypress(overlay, settings.help_cancel_key) else: logging.debug('HELP %s', self.commandname) parser = commands.lookup_parser(self.commandname, ui.mode) diff --git a/alot/defaults/default.bindings b/alot/defaults/default.bindings index ffca1bdc9..1c7d5836c 100644 --- a/alot/defaults/default.bindings +++ b/alot/defaults/default.bindings @@ -91,3 +91,6 @@ q = exit 'g h' = move parent 'g l' = move first reply ' ' = move next + +[help] + esc = cancel diff --git a/alot/settings/manager.py b/alot/settings/manager.py index d9fa724db..65a4500dc 100644 --- a/alot/settings/manager.py +++ b/alot/settings/manager.py @@ -532,3 +532,15 @@ def represent_datetime(self, d): else: rep = pretty_datetime(d) return rep + + @property + def help_cancel_key(self): + """ + Returns cancel key for help overlays + """ + if not hasattr(self, '__help_cancel_key'): + _, helpmap = self.get_keybindings('help') + helpmap = {v: k for k, v in helpmap.items()} + self.__help_cancel_key = helpmap.get('cancel', 'esc') + + return self.__help_cancel_key diff --git a/alot/ui.py b/alot/ui.py index 2c47877fe..72c4a8421 100644 --- a/alot/ui.py +++ b/alot/ui.py @@ -628,13 +628,14 @@ def clear(*_): if block: # put "cancel to continue" widget as overlay on main widget - txt = build_line('(escape continues)', priority) + txt = build_line('(%s continues)' % settings.help_cancel_key, + priority) overlay = urwid.Overlay(txt, self.root_widget, ('fixed left', 0), ('fixed right', 0), ('fixed bottom', 0), None) - self.show_as_root_until_keypress(overlay, 'esc', + self.show_as_root_until_keypress(overlay, settings.help_cancel_key, afterwards=clear) else: if timeout >= 0: