diff options
Diffstat (limited to 'alot/commands/thread.py')
-rw-r--r-- | alot/commands/thread.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py index af5576cb..de948747 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -519,12 +519,16 @@ class EditNewCommand(Command): MODE, 'indent', help='change message/reply indentation', arguments=[(['indent'], {'action': cargparse.ValidatedStoreAction, 'validator': cargparse.is_int_or_pm})]) +@registerCommand( + MODE, 'fold', help='change message folding level', + arguments=[(['fold'], {'action': cargparse.ValidatedStoreAction, + 'validator': cargparse.is_int_or_pm})]) class ChangeDisplaymodeCommand(Command): repeatable = True def __init__(self, query=None, raw=None, all_headers=None, - indent=None, **kwargs): + indent=None, fold = None, **kwargs): """ :param query: notmuch query string used to filter messages to affect :type query: str @@ -534,6 +538,8 @@ class ChangeDisplaymodeCommand(Command): :type all_headers: True, False, 'toggle' or None :param indent: message/reply indentation :type indent: '+', '-', or int + :param fold: message fold level + :type indent: '+', '-', or int """ self.query = None if query: @@ -541,6 +547,7 @@ class ChangeDisplaymodeCommand(Command): self.raw = raw self.all_headers = all_headers self.indent = indent + self.fold = fold Command.__init__(self, **kwargs) def apply(self, ui): @@ -589,6 +596,14 @@ class ChangeDisplaymodeCommand(Command): if all_headers is not None: m.display_all_headers = all_headers + if self.fold is not None: + if self.fold == '+': + m.foldlevel += 1 + elif self.fold == '-': + m.foldlevel -= 1 + else: + m.foldlevel = int(self.fold) + @registerCommand(MODE, 'pipeto', arguments=[ (['cmd'], {'help': 'shellcommand to pipe to', 'nargs': '+'}), |