diff options
-rw-r--r-- | alot/commandfactory.py | 13 | ||||
-rw-r--r-- | alot/commands.py | 14 | ||||
-rw-r--r-- | alot/settings.py | 6 |
3 files changed, 16 insertions, 17 deletions
diff --git a/alot/commandfactory.py b/alot/commandfactory.py index 8ae84aab..58ecbe46 100644 --- a/alot/commandfactory.py +++ b/alot/commandfactory.py @@ -37,16 +37,16 @@ COMMANDS = { 'taglist': (commands.TagListCommand, {}), 'edit': (commands.EditCommand, {}), 'commandprompt': (commands.CommandPromptCommand, {}), + 'openthread': (commands.OpenThreadCommand, {}), + 'refine': (commands.RefineSearchPromptCommand, {}), + 'toggletag': (commands.ToggleThreadTagCommand, {'tag': 'inbox'}), - 'buffer_focus': (commands.BufferFocusCommand, {}), + 'buffer focus': (commands.BufferFocusCommand, {}), 'compose': (commands.ComposeCommand, {}), - 'openthread': (commands.OpenThreadCommand, {}), 'open_envelope': (commands.OpenEnvelopeCommand, {}), 'searchprompt': (commands.SearchPromptCommand, {}), - 'refine': (commands.RefineSearchPromptCommand, {}), 'send': (commands.SendMailCommand, {}), 'thread_tag_prompt': (commands.ThreadTagPromptCommand, {}), - 'toggletag': (commands.ToggleThreadTagCommand, {'tag': 'inbox'}), } @@ -97,7 +97,7 @@ globalcomands = [ ALLOWED_COMMANDS = { 'search': ['refine', 'toggletag', 'openthread'] + globalcomands, 'envelope': ['send'] + globalcomands, - 'bufferlist': globalcomands, + 'bufferlist': ['buffer focus'] + globalcomands, 'taglist': globalcomands, 'thread': ['toggletag'] + globalcomands, } @@ -131,7 +131,7 @@ def interpret_commandline(cmdline, mode): if not params: if cmd in ['exit', 'flush', 'pyshell', 'taglist', 'buffer close', 'buffer next', 'buffer previous', 'buffer refresh', - 'bufferlist', 'refine', 'openthread']: + 'bufferlist', 'refine', 'openthread', 'buffer focus']: return commandfactory(cmd) else: return None @@ -148,6 +148,5 @@ def interpret_commandline(cmdline, mode): filepath = params[0] if os.path.isfile(filepath): return commandfactory(cmd, path=filepath) - else: return None diff --git a/alot/commands.py b/alot/commands.py index 515b904b..1d1b6769 100644 --- a/alot/commands.py +++ b/alot/commands.py @@ -218,12 +218,14 @@ class BufferFocusCommand(Command): Command.__init__(self, **kwargs) def apply(self, ui): - if not self.buffer: - self.buffer = ui.current_buffer - idx = ui.buffers.index(self.buffer) - num = len(ui.buffers) - to_be_focused = ui.buffers[(idx + self.offset) % num] - ui.buffer_focus(to_be_focused) + if self.offset: + idx = ui.buffers.index(ui.current_buffer) + num = len(ui.buffers) + self.buffer = ui.buffers[(idx + self.offset) % num] + else: + if not self.buffer: + self.buffer = ui.current_buffer.get_selected_buffer() + ui.buffer_focus(self.buffer) class OpenBufferListCommand(Command): diff --git a/alot/settings.py b/alot/settings.py index 24a59e1d..2e341004 100644 --- a/alot/settings.py +++ b/alot/settings.py @@ -341,10 +341,9 @@ MAPPING = { 'y': ('send', ''), }, 'bufferlist': { - #'d': ('buffer_close', ''), - #'enter': ('buffer_focus', ''), + 'd': ('buffer_close', ''), + 'enter': ('buffer focus', ''), } - } def get_mappings_by_mode(mode): @@ -360,4 +359,3 @@ def get_mapping(key, mode): return maps[key] else: return None,None - |