diff options
author | Koni Marti <koni.marti@gmail.com> | 2022-03-24 23:12:14 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-03-25 13:07:20 +0100 |
commit | e50ab5928475ef44e880e3391e5ca164c8077ce4 (patch) | |
tree | bb1854fff779df27545789793068fbf38959cdad /commands | |
parent | af2a70983c8d9a940a064c17057d42d92d717883 (diff) | |
download | aerc-e50ab5928475ef44e880e3391e5ca164c8077ce4.tar.gz |
sort: keep sort criteria applied to folder
Keep the sort criteria applied to the selected folder until the default
sort order should be restored. Call the sort command without arguments
to restore the default sort order.
The current behavior is that the default sort order is restored as soon
as the folder reloads. This happens often and then the results of the
sort command are lost. This makes the sort command not very
user-friendly. Instead, we should keep the sort criteria applied until
the user explicitly wants to restore the default sort order again.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/account/sort.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/commands/account/sort.go b/commands/account/sort.go index ad1a402d..c08991c8 100644 --- a/commands/account/sort.go +++ b/commands/account/sort.go @@ -7,6 +7,7 @@ import ( "git.sr.ht/~rjarry/aerc/commands" "git.sr.ht/~rjarry/aerc/lib/sort" "git.sr.ht/~rjarry/aerc/widgets" + "git.sr.ht/~rjarry/aerc/worker/types" ) type Sort struct{} @@ -70,9 +71,15 @@ func (Sort) Execute(aerc *widgets.Aerc, args []string) error { return errors.New("Messages still loading.") } - sortCriteria, err := sort.GetSortCriteria(args[1:]) - if err != nil { - return err + var err error + var sortCriteria []*types.SortCriterion + if len(args[1:]) == 0 { + sortCriteria = acct.GetSortCriteria() + } else { + sortCriteria, err = sort.GetSortCriteria(args[1:]) + if err != nil { + return err + } } aerc.SetStatus("Sorting") |