msglist: highlight marked messages

Note that, until we get color configuration, this means that the user *must*
have the %Z verb in the index format else it'll be horribly confusing
as no visual indication is provided
This commit is contained in:
Reto Brunner 2019-12-18 06:34:07 +01:00 committed by Drew DeVault
parent a744df724f
commit b9d2938f9f
5 changed files with 11 additions and 6 deletions

View File

@ -7,7 +7,7 @@
# with mutt's printf-like syntax. # with mutt's printf-like syntax.
# #
# Default: # Default:
index-format=%D %-17.17n %s index-format=%D %-17.17n %Z %s
# #
# See time.Time#Format at https://godoc.org/time#Time.Format # See time.Time#Format at https://godoc.org/time#Time.Format

View File

@ -39,7 +39,7 @@ func (trig *TriggersConfig) ExecNewEmail(account *AccountConfig,
formatstr, args, err := format.ParseMessageFormat( formatstr, args, err := format.ParseMessageFormat(
account.From, account.From,
part, part,
conf.Ui.TimestampFormat, account.Name, 0, msg) conf.Ui.TimestampFormat, account.Name, 0, msg, false)
if err != nil { if err != nil {
return "", err return "", err
} }

View File

@ -78,7 +78,7 @@ These options are configured in the *[ui]* section of aerc.conf.
| %v | %v
: sender first name (e.g. "Alex" in "Alex Smith <smith@example.net>") : sender first name (e.g. "Alex" in "Alex Smith <smith@example.net>")
| %Z | %Z
: flags (O=old, N=new, r=answered, D=deleted, !=flagged) : flags (O=old, N=new, r=answered, D=deleted, !=flagged, \*=marked)
*timestamp-format* *timestamp-format*
See time.Time#Format at https://godoc.org/time#Time.Format See time.Time#Format at https://godoc.org/time#Time.Format

View File

@ -22,7 +22,8 @@ func parseAddress(address string) *gomail.Address {
func ParseMessageFormat( func ParseMessageFormat(
fromAddress string, fromAddress string,
format string, timestampformat string, format string, timestampformat string,
accountName string, number int, msg *models.MessageInfo) (string, accountName string, number int, msg *models.MessageInfo,
marked bool) (string,
[]interface{}, error) { []interface{}, error) {
retval := make([]byte, 0, len(format)) retval := make([]byte, 0, len(format))
var args []interface{} var args []interface{}
@ -202,6 +203,7 @@ func ParseMessageFormat(
var readReplyFlag = "" var readReplyFlag = ""
var delFlag = "" var delFlag = ""
var flaggedFlag = "" var flaggedFlag = ""
var markedFlag = ""
seen := false seen := false
recent := false recent := false
answered := false answered := false
@ -233,8 +235,11 @@ func ParseMessageFormat(
readReplyFlag = "O" // message is old readReplyFlag = "O" // message is old
} }
} }
if marked {
markedFlag = "*"
}
retval = append(retval, '3', 's') retval = append(retval, '3', 's')
args = append(args, readReplyFlag+delFlag+flaggedFlag) args = append(args, readReplyFlag+delFlag+flaggedFlag+markedFlag)
// Move the below cases to proper alphabetical positions once // Move the below cases to proper alphabetical positions once
// implemented // implemented

View File

@ -109,7 +109,7 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
fmtStr, args, err := format.ParseMessageFormat( fmtStr, args, err := format.ParseMessageFormat(
ml.aerc.SelectedAccount().acct.From, ml.aerc.SelectedAccount().acct.From,
ml.conf.Ui.IndexFormat, ml.conf.Ui.IndexFormat,
ml.conf.Ui.TimestampFormat, "", i, msg) ml.conf.Ui.TimestampFormat, "", i, msg, store.IsMarked(uid))
if err != nil { if err != nil {
ctx.Printf(0, row, style, "%v", err) ctx.Printf(0, row, style, "%v", err)
} else { } else {