diff options
Diffstat (limited to 'alot/commands/thread.py')
-rw-r--r-- | alot/commands/thread.py | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py index a0f148bb..512db7d4 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -484,14 +484,6 @@ class EditNewCommand(Command): @registerCommand( - MODE, 'fold', help='fold message(s)', forced={'visible': False}, - arguments=[(['query'], {'help': 'query used to filter messages to affect', - 'nargs': '*'})]) -@registerCommand( - MODE, 'unfold', help='unfold message(s)', forced={'visible': True}, - arguments=[(['query'], {'help': 'query used to filter messages to affect', - 'nargs': '*'})]) -@registerCommand( MODE, 'togglesource', help='display message source', forced={'raw': 'toggle'}, arguments=[(['query'], {'help': 'query used to filter messages to affect', @@ -507,16 +499,13 @@ class EditNewCommand(Command): 'validator': cargparse.is_int_or_pm})]) class ChangeDisplaymodeCommand(Command): - """fold or unfold messages""" repeatable = True - def __init__(self, query=None, visible=None, raw=None, all_headers=None, + def __init__(self, query=None, raw=None, all_headers=None, indent=None, **kwargs): """ :param query: notmuch query string used to filter messages to affect :type query: str - :param visible: unfold if `True`, fold if `False`, ignore if `None` - :type visible: True, False, 'toggle' or None :param raw: display raw message text. :type raw: True, False, 'toggle' or None :param all_headers: show all headers (only visible if not in raw mode) @@ -527,7 +516,6 @@ class ChangeDisplaymodeCommand(Command): self.query = None if query: self.query = ' '.join(query) - self.visible = visible self.raw = raw self.all_headers = all_headers self.indent = indent @@ -549,7 +537,6 @@ class ChangeDisplaymodeCommand(Command): # make sure indent remains non-negative tbuffer._indent_width = max(newindent, 0) tbuffer.rebuild() - tbuffer.collapse_all() ui.update() logging.debug('matching lines %s...', self.query) @@ -567,21 +554,12 @@ class ChangeDisplaymodeCommand(Command): for m in msg_wgts: # determine new display values for this message - if self.visible == 'toggle': - visible = not m.display_content - else: - visible = self.visible if self.raw == 'toggle': tbuffer.focus_selected_message() raw = not m.display_source if self.raw == 'toggle' else self.raw all_headers = not m.display_all_headers \ if self.all_headers == 'toggle' else self.all_headers - # collapse/expand depending on new 'visible' value - if visible is False: - m.collapse() - elif visible is True: # could be None - m.expand() tbuffer.focus_selected_message() # set new values in messagetree obj if raw is not None: @@ -927,7 +905,6 @@ class OpenAttachmentCommand(Command): 'help': '''up, down, [half]page up, [half]page down, first, last, \ parent, first reply, last reply, \ next sibling, previous sibling, next, previous, \ - next unfolded, previous unfolded, \ next NOTMUCH_QUERY, previous NOTMUCH_QUERY'''})]) class MoveFocusCommand(MoveCommand): @@ -948,16 +925,16 @@ class MoveFocusCommand(MoveCommand): tbuffer.focus_next() elif self.movement == 'previous': tbuffer.focus_prev() - elif self.movement == 'next unfolded': - tbuffer.focus_next_unfolded() - elif self.movement == 'previous unfolded': - tbuffer.focus_prev_unfolded() elif self.movement.startswith('next '): query = self.movement[5:].strip() tbuffer.focus_next_matching(query) elif self.movement.startswith('previous '): query = self.movement[9:].strip() tbuffer.focus_prev_matching(query) + elif self.movement.startswith('thread'): + tbuffer.focus_thread_widget() + elif self.movement.startswith('msg'): + tbuffer.focus_msg_widget() else: MoveCommand.apply(self, ui) # TODO add 'next matching' if threadbuffer stores the original query @@ -976,7 +953,7 @@ class ThreadSelectCommand(Command): logging.info('open attachment') await ui.apply_command(OpenAttachmentCommand(attachment)) else: - await ui.apply_command(ChangeDisplaymodeCommand(visible='toggle')) + ui.current_buffer.focus_toggle() RetagPromptCommand = registerCommand(MODE, 'retagprompt')(RetagPromptCommand) |