summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2019-12-18 06:34:07 +0100
committerDrew DeVault <sir@cmpwn.com>2019-12-21 09:27:53 -0500
commitb9d2938f9fd13c290f187901c2fd43c957a24dd7 (patch)
tree5dd35d07dd56f851752fb6e16dc187ccd51d9f33
parenta744df724f8b7acb0ac231a615192d33c414012e (diff)
downloadaerc-b9d2938f9fd13c290f187901c2fd43c957a24dd7.tar.gz
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
-rw-r--r--config/aerc.conf.in2
-rw-r--r--config/triggers.go2
-rw-r--r--doc/aerc-config.5.scd2
-rw-r--r--lib/format/format.go9
-rw-r--r--widgets/msglist.go2
5 files changed, 11 insertions, 6 deletions
diff --git a/config/aerc.conf.in b/config/aerc.conf.in
index 5feeac0..39548cd 100644
--- a/config/aerc.conf.in
+++ b/config/aerc.conf.in
@@ -7,7 +7,7 @@
 # with mutt's printf-like syntax.
 #
 # 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
diff --git a/config/triggers.go b/config/triggers.go
index f68cb58..3187cf7 100644
--- a/config/triggers.go
+++ b/config/triggers.go
@@ -39,7 +39,7 @@ func (trig *TriggersConfig) ExecNewEmail(account *AccountConfig,
 			formatstr, args, err := format.ParseMessageFormat(
 				account.From,
 				part,
-				conf.Ui.TimestampFormat, account.Name, 0, msg)
+				conf.Ui.TimestampFormat, account.Name, 0, msg, false)
 			if err != nil {
 				return "", err
 			}
diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
index 615c3ab..1d6294e 100644
--- a/doc/aerc-config.5.scd
+++ b/doc/aerc-config.5.scd
@@ -78,7 +78,7 @@ These options are configured in the *[ui]* section of aerc.conf.
 |  %v
 :  sender first name (e.g. "Alex" in "Alex Smith <smith@example.net>")
 |  %Z
-:  flags (O=old, N=new, r=answered, D=deleted, !=flagged)
+:  flags (O=old, N=new, r=answered, D=deleted, !=flagged, \*=marked)
 
 *timestamp-format*
 	See time.Time#Format at https://godoc.org/time#Time.Format
diff --git a/lib/format/format.go b/lib/format/format.go
index 53d93aa..6d638c6 100644
--- a/lib/format/format.go
+++ b/lib/format/format.go
@@ -22,7 +22,8 @@ func parseAddress(address string) *gomail.Address {
 func ParseMessageFormat(
 	fromAddress 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) {
 	retval := make([]byte, 0, len(format))
 	var args []interface{}
@@ -202,6 +203,7 @@ func ParseMessageFormat(
 			var readReplyFlag = ""
 			var delFlag = ""
 			var flaggedFlag = ""
+			var markedFlag = ""
 			seen := false
 			recent := false
 			answered := false
@@ -233,8 +235,11 @@ func ParseMessageFormat(
 					readReplyFlag = "O" // message is old
 				}
 			}
+			if marked {
+				markedFlag = "*"
+			}
 			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
 		// implemented
diff --git a/widgets/msglist.go b/widgets/msglist.go
index aed3ed5..243c5db 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -109,7 +109,7 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
 		fmtStr, args, err := format.ParseMessageFormat(
 			ml.aerc.SelectedAccount().acct.From,
 			ml.conf.Ui.IndexFormat,
-			ml.conf.Ui.TimestampFormat, "", i, msg)
+			ml.conf.Ui.TimestampFormat, "", i, msg, store.IsMarked(uid))
 		if err != nil {
 			ctx.Printf(0, row, style, "%v", err)
 		} else {
id='n325' href='#n325'>325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403