aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/msg/reply.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 066eaca3..12eba928 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -10,6 +10,7 @@ import (
"git.sr.ht/~sircmpwn/getopt"
+ "git.sr.ht/~rjarry/aerc/commands/account"
"git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/lib/crypto"
"git.sr.ht/~rjarry/aerc/lib/format"
@@ -176,6 +177,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
RFC822Headers: msg.RFC822Headers,
}
+ mv, _ := aerc.SelectedTabContent().(*widgets.MessageViewer)
addTab := func() error {
composer, err := widgets.NewComposer(aerc, acct, aerc.Config(),
acct.AccountConfig(), acct.Worker(), template, h, original)
@@ -183,6 +185,10 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
aerc.PushError("Error: " + err.Error())
return err
}
+ if (mv != nil) && aerc.Config().Viewer.CloseOnReply {
+ mv.Close()
+ aerc.RemoveTab(mv)
+ }
if args[0] == "reply" {
composer.FocusTerminal()
@@ -199,8 +205,12 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
})
composer.OnClose(func(c *widgets.Composer) {
- if c.Sent() {
+ switch {
+ case c.Sent():
store.Answered([]uint32{msg.Uid}, true, nil)
+ case mv != nil && aerc.Config().Viewer.CloseOnReply:
+ //nolint:errcheck // who cares?
+ account.ViewMessage{}.Execute(aerc, []string{"-p"})
}
})