From fb8e60c041d7b4a61e5862d6bce6fd3bd8fca000 Mon Sep 17 00:00:00 2001 From: Vitaly Ovchinnikov Date: Mon, 30 Oct 2023 15:35:59 +0000 Subject: binds: folder-specific bindings for composer Add folder-specific bindings for composer, so custom binginds might be specified for a composer opened in a given folder. Changlelog-Added: `[compose::editor:folder=$name]` binding context. Signed-off-by: Vitaly Ovchinnikov Acked-by: Robin Jarry --- app/compose.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/compose.go') diff --git a/app/compose.go b/app/compose.go index 101a5765..9ab8206b 100644 --- a/app/compose.go +++ b/app/compose.go @@ -42,6 +42,7 @@ type Composer struct { acctConfig *config.AccountConfig acct *AccountView + seldir string attachments []lib.Attachment editor *Terminal @@ -92,6 +93,7 @@ func NewComposer( c := &Composer{ acct: acct, acctConfig: acctConfig, + seldir: acct.Directories().Selected(), header: h, parent: orig, email: email, @@ -127,6 +129,10 @@ func NewComposer( return c, nil } +func (c *Composer) SelectedDirectory() string { + return c.seldir +} + func (c *Composer) SwitchAccount(newAcct *AccountView) error { if c.acct == newAcct { log.Tracef("same accounts: no switch") @@ -1682,6 +1688,7 @@ func newReviewMessage(composer *Composer, err error) *reviewMessage { bindings := config.Binds.ComposeReview.ForAccount( composer.acctConfig.Name, ) + bindings = bindings.ForFolder(composer.SelectedDirectory()) reviewCommands := [][]string{ {":send", "Send", ""}, -- cgit