Modularize an envelope view by introducing a stack of "view filters".
Example uses:
- html email can have a view on top of it that is plain text conversion
- selecting and viewing text/* attachments is just appending a new filter at
the stack
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Introduce new DisplayMessageBox struct that handles the rendering of
notifications/notices on the overlay screen.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Make Screen generic over its display kind: Screen<Tty> and
Screen<Virtual>. The latter is for "cached" renderings we want to keep
and copy to the actual screen when the Component::draw() method is
called. Only Screen<Tty> can write to stdout and it needs an stdout
handle.
Add a generation integer field to Screen, that changes each time it is
resized. This way, we can track if "stale" areas are used and panic on
runtime (in debug mode).
Introduce a new type, Area, that keeps metadata about a subsection of a
Screen, and the generation it came from. New areas can only be created
from a Screen and by operating on an Area to create subsections of it.
This way, it's impossible to make an area refer to (x, y) cells outside
the screen generation of its provenance. If stabilised this API should
eliminate all out of bounds accesses in CellBuffers.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
On a previous commit email flag modification logic was changed, but
threads cache was not updated, leading to threads unread count being
stale.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Flag and tag modifications are now somewhat typed better, and the
frontend applies them on its own on success. This means that if you set
an unseen mail as seen but it was already seen in the backend, you will
see the change locally. Previously it would remain unseen.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
This binary was included in the meli crate distribution which wasn't
intended. It's for development purposes only.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
This dependency is necessary, though for some reason the build doesn't
always fail if it's not specified.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
In some situations, we're not compatible with the terminal. Show an
error with details when the terminal size request happens.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Submitting to NNTP/Usenet servers requires you to specify which news
groups the post/article is going to. This commit places all
extra_submission_headers from a backend (in this case only NNTP
implements this) in the composing form fields.
Fixes#267
nntp should add Newsgroups header if missing
<https://git.meli.delivery/meli/meli/issues/267>
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
When navigating the sidebar menu, if you reach the last account entry
and hit next account, nothing happens. This commit makes it so that
you're pointed to the last mailbox instead.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
The command buffer in the envelope view records numbers the user presses
and then combines them with an action (e.g. type n in decimal; press
open_url action to open nth link, analogously with attachments).
Since a few commits ago, the command buffer number stopped being printed
on the envelope view.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
If meli is installed via cargo or a package without manpages, this
command can be used to install them to the user's system.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Instead of showing the nondescript tab names in the tab area,
use Subject or To: data from the draft in the composer and a subject
from the thread entries.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Toggles between horizontal and vertical layout. Previously it was
decided on the terminal width.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
For large threads, this would result in a lot of futures being created.
The user just wants to read one entry, not all of them. So prioritize
the open entry and some of the latest ones as an optimistic
pre-fetching.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Dialogues handled Esc themselves, which meant the event didn't bubble up
to their parent to let them know they should remove the dialogue. This
commit fixes that.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
There's no need to clone MailViews when opening them in new tabs,
just initialize new ones with the same metadata. That saves us the
trouble of implementing Clone for all related types.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
There was no way to provide context to the user why their
command failed to be parsed. This commit paves the way of returning for
invalid domain values, invalid types, etc.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
So that if you select a mail/thread entry that is currently under the
cursor (making it `highlighted`) you can also see its `selected` status.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
When pressing PageUp, PageDown, Home, End shortcuts in ThreadView
entries, the event is bubbled up to the mailbox listing because
ThreadView::process_event() didn't return `true`. This commit fixes
this bug.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
- Use HeaderName in parsers instead of raw byte strings.
- Use byte literal constants where appropriate instead of repeating
&b"___"[..]
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
When adding contacts from an envelope view, its hash/id/key was a random
Uuidv4, so it was always possible to add a contact again and again with
no limits. Now, the id is calculated from the hash of the email address
and display name, preventing duplicate additions.
Note that the hash algorithm is not supposed to be stable across
versions, meaning that in the future the same contact might have a
different hash. This means a more sophisticated method for
detecting/disallowing dupes must eventually be introduced.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Shortcut sections are shown in order, sorted by focus--as if widgets are
stacked vertically by the order you've opened them. In some widgets that
order was wrong.
Also, when a parent widget retrieved its child shortcuts, sometimes it
overwrote children sections if they both have them. This commit adds a
sealed trait ExtendShortcutsMaps that instead of overriding them, it
merges them with the child map having the priority.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Sort with `sort <index> [asc/desc]` command or by pressing `1..5` keys.
Press them again to toggle between asc and desc.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
change_color() predated addition of Cell Attributes (Bold, Underline,
etc) so it didn't accept an attribute argument.
This commit adds a change_theme() function that does the same thing as
change_color() but also sets the cell attributes. It also takes a
ThemeAttribute as an argument instead of {fg, bg, attrs} individually.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
We want to use SortOrder enum for non-thread purposes in the next
commit, so move it out of the thread module.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
We inspect errors in the frontend to check for network errors. If the
network error comes from std::io, this would get converted to an Error
with description "timed out", kind OSError, and source the actual
networking error.
This commit converts network std::io::ErrorKinds into appropriate
native ErrorKinds.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Source Code Annotation Tags:
Global tags (in tagref format <https://github.com/stepchowfun/tagref>)
for source code annotation:
- [tag:hardcoded_color_value] Replace hardcoded color values with user
configurable ones.
- [tag:needs_unit_test]
- [tag:needs_user_doc]
- [tag:needs_dev_doc]
- [tag:FIXME]
- [tag:TODO]
- [tag:VERIFY] Verify whether this is the correct way to do something
- [tag:DEBT] Technical debt