diff options
author | Robin Jarry <robin@jarry.cc> | 2023-07-05 23:10:39 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-07-17 10:24:17 +0200 |
commit | 4c514ce4d15fd14cad528cf426bc3f853efe7f64 (patch) | |
tree | fa52247b470a6af233a6e242962ed20e4831a555 /commands/msg/reply.go | |
parent | 11e5390fa0acbcc609ca177777548dd2d725afbc (diff) | |
download | aerc-4c514ce4d15fd14cad528cf426bc3f853efe7f64.tar.gz |
compose: allow changing edit-headers on the fly
Add -e|-E flags to all compose commands to allow switching between
edit-headers = true/false without restarting aerc.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Tested-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'commands/msg/reply.go')
-rw-r--r-- | commands/msg/reply.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/commands/msg/reply.go b/commands/msg/reply.go index 8cdb50d4..b2a61a80 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -38,12 +38,12 @@ func (reply) Complete(aerc *widgets.Aerc, args []string) []string { } func (reply) Execute(aerc *widgets.Aerc, args []string) error { - opts, optind, err := getopt.Getopts(args, "acqT:") + opts, optind, err := getopt.Getopts(args, "acqT:eE") if err != nil { return err } if optind != len(args) { - return errors.New("Usage: reply [-acq -T <template>]") + return errors.New("Usage: reply [-acq -T <template>] [-e|-E]") } var ( quote bool @@ -51,6 +51,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { closeOnReply bool template string ) + editHeaders := config.Compose.EditHeaders for _, opt := range opts { switch opt.Option { case 'a': @@ -61,6 +62,10 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { quote = true case 'T': template = opt.Value + case 'e': + editHeaders = true + case 'E': + editHeaders = false } } @@ -175,8 +180,8 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { mv, _ := aerc.SelectedTabContent().(*widgets.MessageViewer) addTab := func() error { composer, err := widgets.NewComposer(aerc, acct, - acct.AccountConfig(), acct.Worker(), template, h, - &original, nil) + acct.AccountConfig(), acct.Worker(), editHeaders, + template, h, &original, nil) if err != nil { aerc.PushError("Error: " + err.Error()) return err |