Commit Graph

29 Commits (22525d40fb48661f86657151e35fdf9c95c4b45e)

Author SHA1 Message Date
Manos Pitsidianakis 22525d40fb
mail/listing: go to end when pressing next/page down for the second time
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>
9 months ago
Manos Pitsidianakis 81974311c2
mail/view: show current number command buffer
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>
9 months ago
Manos Pitsidianakis 64ba0459ee
mail/compose: init cursor at To: header field
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
9 months ago
Manos Pitsidianakis 39e99770da
Use Context::current_dir() when saving files to relative paths
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
9 months ago
Manos Pitsidianakis 7e4ed2fa10
view/envelope: fix some out of bounds drawing.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
9 months ago
Manos Pitsidianakis 7e3e938631
mail/view: fix out-of-bounds draw when terminal is small
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 54862f8651
listing.rs: add hide_sidebar_on_launch option
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis b673af02ac
accounts.rs: move to crate root
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis f0075b86cf
ui: show descriptive tab names for composer and threads
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>
10 months ago
Manos Pitsidianakis a615b4701b
dependencies: embed xdg-utils crate
No reason to have it out of the tree.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 0a9c89b6b3
mail/view/thread: add toggle_layout shortcut
Toggles between horizontal and vertical layout. Previously it was
decided on the terminal width.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 49c36009ce
mail/view: don't initialize entire thread at once
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>
10 months ago
Manos Pitsidianakis c7825c76c3
mail/view: handle dialog Esc in the parent component
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>
10 months ago
Manos Pitsidianakis 3344a8dbf6
mail/view: remove unnecessary Clone derives
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>
10 months ago
Manos Pitsidianakis 1b3bebe304
view/thread: open earliest unread email instead of first in thread
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 290cfb86c0
themes: add a highlighted_selected theme key
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>
10 months ago
Manos Pitsidianakis 31aa9ad29e
listing: autogen mbox filename when exporting mail to directories
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 9037f08495
listing: replace hardcoded Key::{Home,End} values with shortcut values
Replace hardcoded Key::{Home,End} values with shortcut values
"home_page" and "end_page".

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis ffba203a3b
sidebar: add support for Home and End key navigation
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 8551e1ba0b
clippy: fix new 1.72 default clippy lints
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 64982b4cab
mail/view/thread: fix page{up,down} event bubbling up
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>
10 months ago
Manos Pitsidianakis 946309c6f3
melib: do some small parser refactoring
- 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>
10 months ago
Manos Pitsidianakis 3963103d55
contacts: prevent duplicate contact creation
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>
10 months ago
Manos Pitsidianakis 96f0b3e6b4
components: fix shortcut section order
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>
10 months ago
Manos Pitsidianakis f93adb683a
meli/terminal: replace change_color uses with change_theme
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>
10 months ago
Manos Pitsidianakis a1e7006186
melib: move Sort{Order,Field} to utils mod
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>
10 months ago
Manos Pitsidianakis 52874f9a97
mail/view: cancel previous jobs on MailView drop/update
When MailView loads a new thread or gets dropped, cancel all pending
jobs.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 5c2b04719b
Normalize std::fmt::* imports 10 months ago
Manos Pitsidianakis 7c9a4b4b7c
meli: Move components/mail -> mail 10 months ago