diff options
author | Bence Ferdinandy <bence@ferdinandy.com> | 2022-12-15 10:19:21 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-12-15 20:31:55 +0100 |
commit | c381bbd4110031df32a5bbc3e3de8c5dc677a6e4 (patch) | |
tree | 0080949189d0eaafdd38bfbbbd9ba2450ca0feb3 | |
parent | 85bfa54baaca7530786c59c29a4acaac2698f656 (diff) | |
download | aerc-c381bbd4110031df32a5bbc3e3de8c5dc677a6e4.tar.gz |
reply: refactor close-on-reply setting to -c flag
Previously close-on-reply was implemented as a setting, making it
unflexible. Refactor so it is a flag to reply `:reply -c`.
Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | commands/msg/reply.go | 17 | ||||
-rw-r--r-- | config/viewer.go | 2 | ||||
-rw-r--r-- | doc/aerc-config.5.scd | 5 | ||||
-rw-r--r-- | doc/aerc.1.scd | 5 |
5 files changed, 15 insertions, 15 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b4b1362f..7d505bcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - built-in `wrap` filter that does not mess up nested quotes and lists. - Write `multipart/alternative` messages with `:multipart` and commands defined in the new `[multipart-converters]` section in `aerc.conf`. +- Close the message viewer before opening the composer with `:reply -c`. ### Changed diff --git a/commands/msg/reply.go b/commands/msg/reply.go index 5aad4fc9..8f536c14 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -37,22 +37,25 @@ func (reply) Complete(aerc *widgets.Aerc, args []string) []string { } func (reply) Execute(aerc *widgets.Aerc, args []string) error { - opts, optind, err := getopt.Getopts(args, "aqT:") + opts, optind, err := getopt.Getopts(args, "acqT:") if err != nil { return err } if optind != len(args) { - return errors.New("Usage: reply [-aq -T <template>]") + return errors.New("Usage: reply [-acq -T <template>]") } var ( - quote bool - replyAll bool - template string + quote bool + replyAll bool + closeOnReply bool + template string ) for _, opt := range opts { switch opt.Option { case 'a': replyAll = true + case 'c': + closeOnReply = true case 'q': quote = true case 'T': @@ -186,7 +189,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { aerc.PushError("Error: " + err.Error()) return err } - if (mv != nil) && config.Viewer.CloseOnReply { + if (mv != nil) && closeOnReply { mv.Close() aerc.RemoveTab(mv) } @@ -209,7 +212,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { switch { case c.Sent(): store.Answered([]uint32{msg.Uid}, true, nil) - case mv != nil && config.Viewer.CloseOnReply: + case mv != nil && closeOnReply: //nolint:errcheck // who cares? account.ViewMessage{}.Execute(aerc, []string{"-p"}) } diff --git a/config/viewer.go b/config/viewer.go index d5e32ac8..c359f43b 100644 --- a/config/viewer.go +++ b/config/viewer.go @@ -15,7 +15,6 @@ type ViewerConfig struct { ParseHttpLinks bool `ini:"parse-http-links"` HeaderLayout [][]string `ini:"-"` KeyPassthrough bool `ini:"-"` - CloseOnReply bool `ini:"close-on-reply"` } func defaultViewerConfig() *ViewerConfig { @@ -30,7 +29,6 @@ func defaultViewerConfig() *ViewerConfig { {"Subject"}, }, ParseHttpLinks: true, - CloseOnReply: false, } } diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd index 2ef3b000..3dea16f6 100644 --- a/doc/aerc-config.5.scd +++ b/doc/aerc-config.5.scd @@ -506,11 +506,6 @@ These options are configured in the *[viewer]* section of _aerc.conf_. Default: _true_ -*close-on-reply* = _true_|_false_ - Close the view tab when replying. If the reply is not sent, reopen the view tab. - - Default: _false_ - # COMPOSE These options are configured in the *[compose]* section of _aerc.conf_. diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd index b477fbaf..ad18c984 100644 --- a/doc/aerc.1.scd +++ b/doc/aerc.1.scd @@ -217,11 +217,14 @@ message list, the message in the message viewer, etc). _[PATCH X/Y]_), all marked messages will be sorted by subject to ensure that the patches are applied in order. -*:reply* [*-aq*] [*-T* _<template-file>_] +*:reply* [*-acq*] [*-T* _<template-file>_] Opens the composer to reply to the selected message. *-a*: Reply all + *-c*: Close the view tab when replying. If the reply is not sent, reopen + the view tab. + *-q*: Insert a quoted version of the selected message into the reply editor *-T* _<template-file>_ |