aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--commands/account/sort.go1
-rw-r--r--doc/aerc.1.scd2
-rw-r--r--lib/sort/sort.go2
-rw-r--r--worker/lib/sort.go2
-rw-r--r--worker/types/sort.go1
6 files changed, 12 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0f97738c..df55324e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased](https://git.sr.ht/~rjarry/aerc/log/master)
+### Added
+
+- New `flagged` criteria for `:sort`
+
### Fixed
- `colorize` styles can include wildcards `?` and `*`
diff --git a/commands/account/sort.go b/commands/account/sort.go
index a7edd552..d9eaf16a 100644
--- a/commands/account/sort.go
+++ b/commands/account/sort.go
@@ -31,6 +31,7 @@ func (Sort) Complete(args []string) []string {
"size",
"subject",
"to",
+ "flagged",
}
if len(args) == 0 {
return supportedCriteria
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index 40cda9a1..e51ae8d1 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -491,6 +491,8 @@ message list, the message in the message viewer, etc).
:- Addresses in the From field
| _read_
:- Presence of the read flag
+| _flagged_
+:- Presence of the flagged flag
| _size_
:- Size of the message
| _subject_
diff --git a/lib/sort/sort.go b/lib/sort/sort.go
index 287f986c..082ba48b 100644
--- a/lib/sort/sort.go
+++ b/lib/sort/sort.go
@@ -51,6 +51,8 @@ func parseSortField(arg string) (types.SortField, error) {
return types.SortSubject, nil
case "to":
return types.SortTo, nil
+ case "flagged":
+ return types.SortFlagged, nil
default:
return types.SortArrival, fmt.Errorf("%v is not a valid sort criterion", arg)
}
diff --git a/worker/lib/sort.go b/worker/lib/sort.go
index 2828999c..7af2c6fa 100644
--- a/worker/lib/sort.go
+++ b/worker/lib/sort.go
@@ -36,6 +36,8 @@ func Sort(messageInfos []*models.MessageInfo,
})
case types.SortRead:
sortFlags(messageInfos, criterion, models.SeenFlag)
+ case types.SortFlagged:
+ sortFlags(messageInfos, criterion, models.FlaggedFlag)
case types.SortSize:
sortSlice(criterion, messageInfos, func(i, j int) bool {
return messageInfos[i].Size < messageInfos[j].Size
diff --git a/worker/types/sort.go b/worker/types/sort.go
index ffbcf463..39f99abb 100644
--- a/worker/types/sort.go
+++ b/worker/types/sort.go
@@ -11,6 +11,7 @@ const (
SortSize
SortSubject
SortTo
+ SortFlagged
)
type SortCriterion struct {