diff options
author | inwit <inwit@sindominio.net> | 2023-10-29 23:45:56 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-11-02 11:59:39 +0100 |
commit | 4bd93fccbf18a855016bd26a3ec8cd9ca7cf5600 (patch) | |
tree | ab1041819a2e50d454111ca7859cfa7ec0700361 /commands | |
parent | 9ce4af011c93e2816ce04012f6205b54e0ed1d51 (diff) | |
download | aerc-4bd93fccbf18a855016bd26a3ec8cd9ca7cf5600.tar.gz |
fold: add an option to toggle folding
Add a toggle option (-t) to :fold/:unfold commands to allow for
switching the folding status of a thread.
Changelog-Added: Toggle folding with `:fold -t`.
Signed-Off-By: inwit <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
Tested-by: Jason Cox <me@jasoncarloscox.com>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/msg/fold.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/commands/msg/fold.go b/commands/msg/fold.go index 06e933d7..f3f55871 100644 --- a/commands/msg/fold.go +++ b/commands/msg/fold.go @@ -7,7 +7,9 @@ import ( "git.sr.ht/~rjarry/aerc/lib/ui" ) -type Fold struct{} +type Fold struct { + Toggle bool `opt:"-t" aliases:"fold,unfold"` +} func init() { register(Fold{}) @@ -17,7 +19,7 @@ func (Fold) Aliases() []string { return []string{"fold", "unfold"} } -func (Fold) Execute(args []string) error { +func (f Fold) Execute(args []string) error { h := newHelper() store, err := h.store() if err != nil { @@ -31,9 +33,9 @@ func (Fold) Execute(args []string) error { switch strings.ToLower(args[0]) { case "fold": - err = store.Fold(msg.Uid) + err = store.Fold(msg.Uid, f.Toggle) case "unfold": - err = store.Unfold(msg.Uid) + err = store.Unfold(msg.Uid, f.Toggle) } ui.Invalidate() return err |