ref: 0.3.0 aerc/widgets d---------
Allow fields in compose widget to be clicked

When the mouse is enabled, clicking on a header field switches focus to
that field (likewise for the terminal).
Complete the F rune.

%F now shows the auth name or recepient name/address if the
message is from you.
Add UI options to save/pipe messages with unsupported mimetypes

Adds a message indicating the user's ability to :save or :pipe a message
with an unsupported mimetype and also adds a selector widget (similar to
the tutorial).

The selector widget was previously defined in the account wizard module,
so this commit breaks it out into its own module to allow for re-use.

Further, modify the BeginExLine() function to take an argument that
pre-populates the command line, allowing functions to initiate an ex
command without executing it.

Closes #95.
Check for terminal before forwarding mouse event

When viewing a message part with no available filter, clicking the UI
would cause a nil pointer dereference because the MouseEvent was passed
to the PartViewer's `term` field, which does not exist in the case of an
absent filter.
Add some defaults for template options
Add Templates with Parsing

+ Changes NewComposer to return error.
+ Add lib to handle templates using "text/template".
+ Add -T option to following commands
    - compose.
    - reply
    - forward
+ Quoted replies using templates.
+ Forwards as body using templates
+ Default templates are installed similar to filters.
+ Templates Config in aerc.conf.
    - Required templates are parsed while loading config.
+ Add aerc-templates.7 manual for using template data.
widgets/msgviewer: Don't crash if pager is nil

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
widgets/msgview: Reap the filter command

The filter command shells out and returns almost immediately. Call
Wait() so the filter process gets reaped. Prior to this patch, aerc
creates a zombie process for every email that is viewed.

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
Cleanup pager processes after closing a msgviewer

A pager is spawned every time an email is viewed but not killed off when
quitting the msgviewer, thus leading to process leakage. This patch
fixes this by adding a Close method to the msgview widget, which is
called in the close command.

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
Revert "Show spinner when fetching contents"

This reverts commit 1339faf7881f33762c6e0a4915404e362fc51de1.
Show spinner when fetching contents

The spinner should be shown when fetching the contents as we don't know
at that point whether there are some messages or not.
Fix selected account to return for messageviewer

This ensures that the selectedaccount is returned if currently selected
tab is a messageviewer. This also makes it more extensible for adding
other ways of getting the selected account.
Add sorting functionality

There is a command and config option. The criteria are a list of the
sort criterion and each can be individually reversed.

This only includes support for sorting in the maildir backend currently.
The other backends are not supported in this patch.
Revert "Fix out-of-order messages by sorting as we display"

This reverts commit ac99d9ed62644cf0259bdd79481b28c3fbcef650.
widgets: remove duplicate import

Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
Add signatures

This adds the ability for per-account signatures in the accounts.conf
config file. The signature is added to emails in the editor at the
bottom of the email. This includes when forwarding, replying to, and
composing emails.

There are two config options: signature-file and signature-cmd. The
former allows a signature to be read from a file and the latter allows
an arbitrary command to be executed to return the signature.

The config options have been documented in aerc-config
Add modify-labels command

This adds the event type as well as the command implementation, but no backend
supports it yet.
Add display of unread messages in dirlist

Add an onUpdateDirs handler. This is used to invalidate the dirlist and
redraw with the correct number of recent/unread/total messages is shown.

A config option and formatting options are provided.
Fix segfault on delete
Add Mouseable

This adds the Mouseable interface. When this is implemented for a
component that item can accept and process mouseevents.

At the top level when a mouse event is received it is passed to the
grid's handler and then it trickles down until it reaches a component
that can actually handle it, such as the tablist, dirlist or msglist.

A mouse event is passed so that components can handle other things such
as scrolling with the mousewheel. The components themselves then perform
the necessary actions.

Clicking emails in the messagelist opens them in a new tab.

Textinputs can be clicked to position the cursor inside them.

Mouseevents are not forwarded to the terminal at the moment.

Elements which do not handle mouse events are not required to implement
the Mouseable interface.
widgets: gofmt

Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>