diff options
author | Srivathsan Murali <sri@vathsan.com> | 2020-01-23 13:56:48 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-01-24 10:50:21 -0500 |
commit | b2fa5a16f52741a6f7f6e5f33561457d702dc31d (patch) | |
tree | 3c44cd8f100e0e8c156ad2bbe17ba46fb68a2e01 /widgets/msglist.go | |
parent | aa967682bcdbeaa11b3e79d66b1d68b129dd4161 (diff) | |
download | aerc-b2fa5a16f52741a6f7f6e5f33561457d702dc31d.tar.gz |
Contextual UI Configuration
+ Adds parsing of contextual ui sections to aerc config.
+ Add GetUiConfig method for AercConfig that is used to get the
specialized UI config.
+ Add UiConfig method to AccountView to get specialized UI Config.
+ Modifies Aerc codebase to use specialized UIConfig instead.
+ Adds documentation for Contextual UI Configuration
Diffstat (limited to 'widgets/msglist.go')
-rw-r--r-- | widgets/msglist.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/widgets/msglist.go b/widgets/msglist.go index 243c5dbc..24a99404 100644 --- a/widgets/msglist.go +++ b/widgets/msglist.go @@ -106,10 +106,16 @@ func (ml *MessageList) Draw(ctx *ui.Context) { } ctx.Fill(0, row, ctx.Width(), 1, ' ', style) + uiConfig := ml.conf.GetUiConfig(map[int]string{ + config.UI_CONTEXT_ACCOUNT: ml.aerc.SelectedAccount().AccountConfig().Name, + config.UI_CONTEXT_FOLDER: ml.aerc.SelectedAccount().Directories().Selected(), + config.UI_CONTEXT_SUBJECT: msg.Envelope.Subject, + }) + fmtStr, args, err := format.ParseMessageFormat( ml.aerc.SelectedAccount().acct.From, - ml.conf.Ui.IndexFormat, - ml.conf.Ui.TimestampFormat, "", i, msg, store.IsMarked(uid)) + uiConfig.IndexFormat, + uiConfig.TimestampFormat, "", i, msg, store.IsMarked(uid)) if err != nil { ctx.Printf(0, row, style, "%v", err) } else { @@ -265,7 +271,7 @@ func (ml *MessageList) Scroll() { } func (ml *MessageList) drawEmptyMessage(ctx *ui.Context) { - msg := ml.conf.Ui.EmptyMessage + msg := ml.aerc.SelectedAccount().UiConfig().EmptyMessage ctx.Printf((ctx.Width()/2)-(len(msg)/2), 0, tcell.StyleDefault, "%s", msg) } |