diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-05-05 11:23:22 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-05-05 11:24:33 +0200 |
commit | 8ce767fe63cd8a89f243671ae0ada8975c2c7639 (patch) | |
tree | b50d56ee741cb66715ff5dc3d64a5da25f3031b0 /alot/commands | |
parent | 85f50af0ebde0d07ba47bea1bcf916d692567252 (diff) |
thread: add basic support for folding long quoted blocks
Diffstat (limited to 'alot/commands')
-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': '+'}), |