diff options
author | Koni Marti <koni.marti@gmail.com> | 2022-10-23 21:27:10 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-11-09 21:15:22 +0100 |
commit | 20554d8460e96a408cfd779e1158dec78b639028 (patch) | |
tree | 2bd6f5f4b1e7d4205a4df1d56f7223e6f5bcd13a /commands | |
parent | f479ae8c6e550dade0f183da9d3d7760f406d806 (diff) | |
download | aerc-20554d8460e96a408cfd779e1158dec78b639028.tar.gz |
composer: add message preview
Add message preview to the composer. Add preview option to the review
window. Open the message in a message viewer before sending to check the
headers and attachments.
Implements: https://todo.sr.ht/~rjarry/aerc/86
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/eml.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/commands/eml.go b/commands/eml.go index 45dd4f25..864145ce 100644 --- a/commands/eml.go +++ b/commands/eml.go @@ -1,6 +1,7 @@ package commands import ( + "bytes" "fmt" "io" "os" @@ -17,7 +18,7 @@ func init() { } func (Eml) Aliases() []string { - return []string{"eml"} + return []string{"eml", "preview"} } func (Eml) Complete(aerc *widgets.Aerc, args []string) []string { @@ -54,6 +55,16 @@ func (Eml) Execute(aerc *widgets.Aerc, args []string) error { case *widgets.MessageViewer: part := tab.SelectedMessagePart() tab.MessageView().FetchBodyPart(part.Index, showEml) + case *widgets.Composer: + var buf bytes.Buffer + h, err := tab.PrepareHeader() + if err != nil { + return err + } + if err := tab.WriteMessage(h, &buf); err != nil { + return err + } + showEml(&buf) default: return fmt.Errorf("unsupported operation") } |