Commit Graph

316 Commits (0882dbbad025f9f4f072f8a30564f417b37aa935)

Author SHA1 Message Date
Manos Pitsidianakis ab30733ce7
SegmentTree: add update() method 4 years ago
Manos Pitsidianakis c2980f5dcf
RateLimit: add test 4 years ago
Manos Pitsidianakis 3573423169
PosixTimer: rearm timer only when calling rearm() 4 years ago
Manos Pitsidianakis 1717aa7845
bin: use self-pipe in signal handler
send_timeout() isn't signal safe, and might block.
4 years ago
Manos Pitsidianakis 7990b71c19
StatusBar: recognize readline shortcuts in Execute mode 4 years ago
Manos Pitsidianakis 295577f9d7
Fix invalid theme keys in ThreadListing 4 years ago
Manos Pitsidianakis a86c1cbb26
listing: redraw on EnvelopeUpdate events 4 years ago
Manos Pitsidianakis c5fe511d95
notmuch: don't remove tags from tag_index
When removing a tag, we shouldn't also remove it from the tag index.
4 years ago
Manos Pitsidianakis a6af7fc0d3
listing.rs: don't create unnecessary operation 4 years ago
Manos Pitsidianakis 8648b229ad
Add AccountHash to RefreshEvent
Different accounts might have same inboxes with same MailboxHashes. Use
the hash of the account's name to differentiate.
4 years ago
Manos Pitsidianakis eb701695f7
Remove fnv crate 4 years ago
Manos Pitsidianakis 3ea1ce5454
errors: add `source` field to MeliError 4 years ago
Manos Pitsidianakis d405aa9797
Show last worker thread heartbeat on status page 4 years ago
Manos Pitsidianakis c8391983ee
Refactor OfflineListing
Move offline status drawing to OfflineListing
4 years ago
Manos Pitsidianakis d580b25415
themes: overwrite only explicit key attributes
If user config file overwrites a single attribute and not the others,
for example only bg:

  "mail.listing.tag_default" = { bg = "Blue" }

The other attributes, in this case fg and attrs revert to the default
values of ThemeAttributeInner and not the default value for the key
"mail.listing.tag_default". As a result the above expands to:

  "mail.listing.tag_default" = { fg = Color::Default, bg = "Blue", attrs
  = Attr::Default }

This commit keeps the key value defaults, so the above should expand to:

  "mail.listing.tag_default" = { fg = default_theme["mail.listing.tag_default"].fg, bg = "Blue", attrs
  = default_theme["mail.listing.tag_default"].attrs }
5 years ago
Manos Pitsidianakis 18dcf15e1e
Add open_mailbox shortcut for sidebar 5 years ago
Manos Pitsidianakis d8135674df
themes: add {even,odd}_unseen, {even,odd}_selected, {even,odd}_highlighted
Suggested in #21
5 years ago
Manos Pitsidianakis e633434b93
themes: Fix invalid attribute links panic in is_cyclic
Attribute links are not checked for validity in theme validation, and an
invalid link would cause a panic in is_cyclic.

This commit improves the theme validation errors by printing if the
error lies in a theme key or a link.
5 years ago
Manos Pitsidianakis 4930d1b46c
Add Italics, Blink, Dim and Hidden text attributes
Text attributes have been rewritten as bit flags, so for example instead of
"BoldUnderline" you'd have to define "Bold | Underline" in your theme
settings.

Requested in #21
5 years ago
Manos Pitsidianakis e9a935dbf7
melib: add search method in mail backends 5 years ago
Manos Pitsidianakis 3d7b9ff7cb
Move Query to melib 5 years ago
Manos Pitsidianakis fd60be482f
Open sidebar for mailbox navigation with Left/Right arrow keys
Left/Right arrow keys change focus between the sidebar and mailbox
listing. If focused on sidebar, move arrow keys to select mailbox and
open with 'Enter'. Press Right arrow key to return to mailbox listing.

- Mailbox focused:
  +--+-------------+
  |~ |=============|
  |~ |=============|
  |  |=============|
  |~ |=============|
  |~ |=============|
  +--+-------------+
- Press `Left` arrow key
- Menu focused:
  +--------+-------+
  |~~~~    |=======|
  |~~      |=======|
  |        |=======|
  |~~~     |=======|
  |~~~~    |=======|
  +--------+-------+
- Press `Right` arrow key to return
5 years ago
Manos Pitsidianakis 840005022c
themes: add default tag theme attribute
The theme attribute key is "mail.listing.tag_default"
5 years ago
Manos Pitsidianakis e034f4dd52
view.rs: fix redrawing errors 5 years ago
Manos Pitsidianakis a3903ea2cb
Show Cc in default headers in mail view 5 years ago
Manos Pitsidianakis 4c32bf450d
Add {un,}subscribe mailbox operations
Concerns #17
5 years ago
Manos Pitsidianakis 9ff54f236b
Add conf_override! macro
conf_override! wraps struct definitions and defines a secondary Override
struct that wraps each field in an Option. The macro mailbox_settings!
is used to select settings from an account & mailbox index. If a user defines an overriding setting, the macro returns the override instead of the immediately next in the hierarchy setting.

The selection is done for a specific field as follows:

  if per-folder override is defined, return per-folder override
    else if per-account override is defined, return per-account override
      else return global setting field value.
5 years ago
Manos Pitsidianakis a8c1016f37
Add various logic checks 5 years ago
Manos Pitsidianakis 1811fb51cb
Fix unused imports/code compiler warnings 5 years ago
Manos Pitsidianakis b7175c2400
Fix compiler error in --no-default-features build 5 years ago
Manos Pitsidianakis 84d7e4c034
Small documentation fixes 5 years ago
Manos Pitsidianakis 31d90e1d87
Add managesieve.rs 5 years ago
Manos Pitsidianakis 651dda67cf
Respect autoload mailbox setting 5 years ago
Manos Pitsidianakis 106dae3334
Add config overrides to mailbox filter
If per-folder config filter is defined, it overrides the app-wide
filter.
5 years ago
Manos Pitsidianakis a3600c0cd2
Add `filter` option in mail list
Filter mail in mail list.

Example:
[listing]
filter = "not flags:seen" # show only unseen messages
5 years ago
Manos Pitsidianakis 9d20fd5576
Save forked processes for reaping 5 years ago
Manos Pitsidianakis 6c76db2063
Add delete, copy actions for envelopes 5 years ago
Manos Pitsidianakis 2a9059f9b4
Add add-attachment from pipe, default_header_values 5 years ago
Manos Pitsidianakis 63467a3c45
Check ComponentId equality on Composer::kill() 5 years ago
Manos Pitsidianakis 63af2a688a
Detect breaks on write_string_to_grid 5 years ago
Manos Pitsidianakis f10cc954e7
Don't dump mail on Account drop 5 years ago
Manos Pitsidianakis a94bb1e27a
Show float notification on refresh cmd 5 years ago
Manos Pitsidianakis 670485e8c7
compose: clear bounds of compose area properly 5 years ago
Manos Pitsidianakis 7b631beb0a
Don't panic in WorkController::drop 5 years ago
Manos Pitsidianakis ca51077f53
imap: Add support for untagged FETCH (FLAG.. messages
IDLE connection can get untagged "* FETCH (FLAGS ({flag_list))" messages
if any client has changed flags. Support this refresh event.
5 years ago
Manos Pitsidianakis 53fa3d03da
Notify embedded terminal on embedded process exit
When an embedded process exits the main process receives a SIGCHLD. The
check on whether the embedded process is alive is done on input, so
forward an input of '\0' to get the embedded terminal to notice its
child is dead.
5 years ago
Manos Pitsidianakis 126b65817e
Forward input on input/rawinput switch
Input thread listens on stdin input and forwards the input to the main
process. When an embedded terminal is launched within the main process,
the input thread is asked to switch to raw input, that is to send the
parsed input and the raw bytes to the main process in order to get them
forwarded to the embedded terminal. The switch happens by calling
get_events and get_events_raw.

When the input thread receives an InputCommand::{No,}Raw, it has already
received an input event, since the `select!` is within the
stdin events for loop. (There's no way to `select` on blocking iterators
or raw fds, which is unfortunate.).

This commit forwards the input to the next function instead of dropping
it.
5 years ago
Manos Pitsidianakis 7807f565ec
Clear input thread channel on restore()
The channel may contain Kill commands that will cause the new thread to
exit immediately.
5 years ago
Manos Pitsidianakis 65666e6695
Fix double call of restore_input
restore_input is called in State::rcv_event on arrival of a fork
finished event:

```
            UIEvent::Fork(ForkType::Finished) => {
                self.switch_to_main_screen();
                self.switch_to_alternate_screen();
                self.context.restore_input();
                return;
            }
```

So there shouldn't be an extra call here.
5 years ago
Manos Pitsidianakis bae083cc8f
Rename Filter action to search 5 years ago
Manos Pitsidianakis 760c1e859d
Add search shortcut to shortcut map 5 years ago
Manos Pitsidianakis 33c1bf6558
Add consume newlines flag to phrase() 5 years ago
Manos Pitsidianakis ac71d627f1
Implement search for CellBuffer 5 years ago
Manos Pitsidianakis 4ac52d9d5b
Replace every use of Folder with Mailbox
Use Mailbox for consistency.
5 years ago
Manos Pitsidianakis 1245eae0be
Add Knuth–Morris–Pratt to pager 5 years ago
Manos Pitsidianakis c9469f26ee
Remove duplicate function timer::arm()
arm() was a duplicate of set_value()
5 years ago
Manos Pitsidianakis 45c0160cb6
Fix ThreadListing
ThreadListing was broken after the ThreadGroup introduction
5 years ago
Manos Pitsidianakis 68007a0842
View decoded email source by default
Toggle between decoded/raw source with view_raw_source shortcut, default
M-r
5 years ago
Manos Pitsidianakis 44da24fc96
Add left/right cursor mvments to execute bar 5 years ago
Manos Pitsidianakis c88d1cae51
Fix create_box boundary fg color 5 years ago
Manos Pitsidianakis c4c11e4abc
Make Selector widget accept FnOnce 5 years ago
Manos Pitsidianakis 499fd59c6e
melib/imap: implement refresh() 5 years ago
Manos Pitsidianakis f38d03e43a
melib: {create,delete}_folder returns updated folders
Potential parent folders will have their children fields updated, so
just return all folders.
5 years ago
Manos Pitsidianakis e3abd458ce
Add ui_dialogs in State 5 years ago
Manos Pitsidianakis a806571322
Add UIDialog and UIConfirmationDialog widgets
They are just typedefs for the Selector widget. The API is kind of
messed up and this commit is part of the process of cleaning it up:
right now to use this, you check the is_done() method which if returns
true, the done() method executes the closure you defined when creating
the widget. The closure returns a UIEvent which you can forward
application-wide by context.replies.push_back(event) or handle it in
process_event() immediately.
5 years ago
Manos Pitsidianakis e22ab2b424
ui: fix shortcuts map title not showing up on resize 5 years ago
Manos Pitsidianakis d779a94279
Fix sent_folder not getting recorded if no explicit folder conf is set 5 years ago
Manos Pitsidianakis b6efb14824
melib: remove Mailbox
Refactor Collection from melib to hold what folders have what envelopes.

Frontend accounts will now have a FolderEntry for each logical folder
and will unify many Account fields into one and eliminate a lot of
duplicate/dead code.
5 years ago
Manos Pitsidianakis b50e770b5a
ui/accounts: remove Index<usize> impls 5 years ago
Manos Pitsidianakis aab6b02db2
ui: clear selection with Esc 5 years ago
Manos Pitsidianakis 4090eecd04
ui: Consume Esc input events only when necessary 5 years ago
Manos Pitsidianakis 14b0ef8f37
Respect use_color conf value as well as NO_COLOR 5 years ago
Manos Pitsidianakis fead7a5da4
meli: add invalid flag combo check 5 years ago
Manos Pitsidianakis 0aa2659072
meli: add cli-docs feature
Optionally build manpages to text with mandoc and print them from the
command line.
5 years ago
Manos Pitsidianakis c22a141b14
ui/themes: expand theme coverage to status panel and contacts 5 years ago
Manos Pitsidianakis 22fb0c0844
ui: handle ViewMailbox in listing.rs
handling viewmailbox inside a listing instead of their parent/manager
component is a leftover from before they even had a parent/manager.
5 years ago
Manos Pitsidianakis 647cb10b33
ui: Use FolderHash instead of usize for folder cursor
Use FolderHash directly as a cursor type for folders within an account
isntead of having a usize (being the order of the folder within the
account) and figuring out the folder_hash everytime it's needed.

Add OfflineListing for offline accounts and AccountStatusChange event.
5 years ago
Manos Pitsidianakis 42747ef590
ui/themes: make theme_default the default for other keys 5 years ago
Manos Pitsidianakis eef007600b
ui: improve theming coverage 5 years ago
Manos Pitsidianakis 9b7875c023
ui: change Component::get_status return type
There was no reason to return Option<String>, just return String::new()
instead of Option::None
5 years ago
Manos Pitsidianakis cadb1e1613
ui/conf: expand include() paths in config
Expand variables and `~` in included paths in user configuration.
5 years ago
Manos Pitsidianakis 0b4109dfdb
ui: fix wrong subscription status in folders
Subscription status was checked/modified in various places, whereas now
the universal truth is the `BackendFolder::is_subscribed()` method set
by the backend when a folder is created. The `Account` struct passes a
closure to the backend constructor that determines whether the folder is subscribed or not according to the user configuration.

- If subscribed_folders field is empty, then all folders are subscribed.
- OR check explicit folder configuration
- OR check if folder path matches to a glob in subscribed_folders.
5 years ago
Manos Pitsidianakis 50bfed7247
ui: fix subtraction overflow 5 years ago
Manos Pitsidianakis eb501b6d50
ui: add ThemeAttribute argument to clear_area()
clear_area() sets the cleared cell attributes according to the new
argument.
5 years ago
Manos Pitsidianakis 3bca6d1d9c
ui: add floating notifications within terminal
`DisplayMessage` messages are for user input responses (eg errors for
user actions). They now appear as floating boxes in the bottom right
corner of the UI and can be browsed with Alt('<') and Alt('>')
5 years ago
Manos Pitsidianakis 4a4c8e265a
ui: add overlay grid
Add second layer grid for overlays (messages, notifications)
5 years ago
Manos Pitsidianakis 333db9ed37
ui: remove notifications from StatusBar
It's bad UX, they aren't very visible.
5 years ago
Manos Pitsidianakis d6e3c51b07
ui: move box drawing to src/terminal
No logical reason for it not to be in the terminal module anymore (the
set_and_join* functions predate the terminal module which is why they
weren't there to begin with).
5 years ago
Manos Pitsidianakis f131e01bfc
Fix drawing getting stuck in empty terminal
Fix drawing getting stuck in loops when terminal is too small by
checking for it.
5 years ago
Manos Pitsidianakis 4301fa3b04
ui: Change ascii branch drawings in attachment tree 5 years ago
Manos Pitsidianakis af38b1306a
ui: use quoted_argument parser in Ex command arguments 5 years ago
Manos Pitsidianakis 144eb62b76
ui: force refresh_mailbox etc on Mailbox{Delete,Create} 5 years ago
Manos Pitsidianakis f5e694cf5a
Make small cosmetic fixes 5 years ago
Manos Pitsidianakis f208948651
melib: add mailbox delete/create to IMAP 5 years ago
Manos Pitsidianakis d6f04c9ed3
Fix IntoIterator warning 5 years ago
Manos Pitsidianakis 05b91f1c02
Remove text_processing
Unwrap text_processing into melib

In preparation for uploading meli as a separate crate on crates.io.
5 years ago
Manos Pitsidianakis 8b6ea8de9a
Remove ui crate
Merge ui crate with root crate.

In preparation for uploading `meli` as a separate crate on crates.io.

Workspace crates will need to be published as well and having a separate
`ui` crate and binary perhaps doesn't make sense anymore.
5 years ago
Manos Pitsidianakis 6fcc792b83
Remove src/python
In preparation for publishing meli as a separate crate on crates.io.

src/python was never used for anything, so remove it.
5 years ago
Manos Pitsidianakis dbc0fd81af
Rename config file to config.toml 5 years ago
Manos Pitsidianakis b823969ae2
small fixes
- Don't debug print Timer events in src/bin.rs event loop; they're too
frequent and pollute the logs
- chain set_{fg,bg,..} method calls for &mut Cell
- remove unneeded u8 to u8 cast
5 years ago
Manos Pitsidianakis 8ec82b836a
Add 2 theme-related cli flags 5 years ago
Manos Pitsidianakis f58ed387dd
ui: add ratelimiting in UI notifications and drawing 5 years ago
Manos Pitsidianakis 5e912db461
Send timer ID as si_value to SIGALRM handler
Associate each alarm signal with the timer of its origin.
5 years ago
Manos Pitsidianakis a365a846b8
Replace StackVec with smallvec::SmallVec
SmallVec has a less buggy and better implementation.
5 years ago
Manos Pitsidianakis beeea9a0c1
ui: implement PosixTimer
Add interface for posix timers timer_create(2) time(7)
5 years ago
Manos Pitsidianakis 17a0f31b3e
ui/accounts: split StartupCheck event semantics
UIEvent::StartupCheck was meant to notify the UI that a folder had made
progress and polling its async worker would return a
Result<Vec<Envelope>>. However the StartupCheck was received by
MailListing components which called account.status() which did the
polling. That means that if the polling got back results, the listing
would have to call account.status() again to show them. This is a
problem in configurations with only one account because there aren't any
other sources of event to force the listing to recheck account.status()

A new event UIEvent::WorkerProgress will do the job of notifying an
Account to poll its workers and the account will send a startupcheck if
it has made progress. That way the refresh progress is as follows:

Worker thread sends WorkerProgress event -> State calls appropriate
account's account.status() method -> account polls workers, and if there
are new results send StartupCheck events -> State passes StartupCheck
events to components -> Listings update themselves when they receive the
event
5 years ago
Manos Pitsidianakis 59f7f03d64
ui: refactor watch thread spawning procedure
- Remove unnecessary parameters from watch(), reload()
- Add NewThread event that adds new threads in
work_controller.static_threads hashmap
- removed obsolete field State.threads
- silence watch thread error notifications
5 years ago
Manos Pitsidianakis ef26b03bb6
Add some documentation 5 years ago
Manos Pitsidianakis af365fa8d4
Set 600 perm mode to all created files
When creating a data file, set permissions to read/write for the user.
5 years ago
Manos Pitsidianakis 874a252394
ui: add periodic account connectivity check
1. spawn thread to send ThreadPulses to the main event loop that "parks" until unparked from State
2. State unparks thread if there are accounts that are offline
3. thread sends ThreadPulse and parks again
4. State checks accounts again and so on.
5 years ago
Manos Pitsidianakis 3d3ead02e9
bin: add --test-config flag
meli --test-config PATH tests a configuration file for syntax issues or missing options.

Caveat: right now undefined options/values do not return an error.
Backend specific options are also not validated.
5 years ago
Manos Pitsidianakis 0cea6368d9
ui/embed: fix scrolling area issues 5 years ago
Manos Pitsidianakis 321be8555f
Cleanup startup error exit paths
Make startup methods return Results so that the main binary can exit
cleanly instead of using std::process::exit from arbitrary positions,
which exits the process immediately and doesn't run destructors.
5 years ago
Manos Pitsidianakis 99da9a35b6
Add embed pty support
Emulate a terminal within meli. In the next commit it will be used to
embed an editor in the composing tab.

This is a non-complete xterm emulation that has some bugs.
5 years ago
Manos Pitsidianakis a9425be61e
ui/contacts: add side-menu, remove accounts tab
- Rename accounts tab to status tab
- add side menu to contacts tab to switch between accounts
5 years ago
Manos Pitsidianakis 212e9bd701
Revert "Show manuals with command line arguments"
Since this commit requires `mandoc` as a build dependency, it is removed
for now until a better compromise is found.

This reverts commit 6a8f869e5b.
5 years ago
Manos Pitsidianakis 6a8f869e5b
Show manuals with command line arguments
Add --manual, --conf-manual command line arguments that display manpages
through a pager. If no pager is found, this currently fails. It should
print the manuals to stdout instead.

The manuals are read from src/manuals and are generated with mandoc
whenever changes to the manpage sources meli.1 and meli.conf.5 are made.
5 years ago
Manos Pitsidianakis ee9ffffa12
bin: C-L issues manual redraw 5 years ago
Manos Pitsidianakis d44a68ec69
ui: don't quit if editing a draft
Ask user to save draft or discard it.
5 years ago
Manos Pitsidianakis b07db29a19
ui: add timer tick every 300ms
Check for pending events in the main process by receiving a timer event
every 300ms. This way loaded folders or received emails will get
recognized even if the appropriate informing signals got lost.
5 years ago
Manos Pitsidianakis f394fde143
add priority and info to jobs and workers
jobs now have a priority given to them, in order to parse some mailboxes
(eg INBOX, Sent) first.

worker threads now can set their names and status
5 years ago
Manos Pitsidianakis 81a55abc7c
Update crossbeam to 0.7.2 and remove chan 5 years ago
Matthias Beyer 6e716946b7
Reformat to be a proper rust comment
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
5 years ago
Manos Pitsidianakis 2a1bf37e69
Add --version command line flag 5 years ago
Manos Pitsidianakis df5559023d
add --help, --config, --create-config arguments 5 years ago
Manos Pitsidianakis 93f3d6e230
remove std::dbg uses 5 years ago
Manos Pitsidianakis fb406667ab
add debug! macro to replace eprintlns 5 years ago
Manos Pitsidianakis 69031e66f9
ui: move account menu functions to Listing
AccountMenu was completely semantically attached to Listing, so there's
no reason for them to be separate and communicating via events.
5 years ago
Manos Pitsidianakis 9bc76e3bcb
ui: unwrap UIEventType 5 years ago
Manos Pitsidianakis 106744c7ca
ui: remove Entity 5 years ago
Manos Pitsidianakis ee4462881e
run cargo fmt 5 years ago
Manos Pitsidianakis 1c7aa0ec9c
update to 2018 edition 5 years ago
Manos Pitsidianakis 551db51b00
ui: avoid full renders when worker threads return StartupChecks
Now listings only re-render when their folder gets a StartupCheck event,
account menu always re-renders to update new mail counts

closes #76
5 years ago
Manos Pitsidianakis 1867bb6aa3
ui: hide divider column in VSplit if !self.show_divider 5 years ago
Manos Pitsidianakis a2e81ed354
ui: enter EX mode with space 5 years ago
Manos Pitsidianakis bf038428c2
Run rustfmt 5 years ago
Manos Pitsidianakis 1bb1cf7aac
add notification filter
concerns #64
5 years ago
Manos Pitsidianakis 4ee5447cf9
Add FormWidget/ButtonWidget and use them in Contacts 5 years ago
Manos Pitsidianakis 62168e9183
Add contact view page, edit headers in compose, index style in conf 5 years ago
Manos Pitsidianakis 92bb3bf8d3
ui: add contacts and account panel 5 years ago
Manos Pitsidianakis 5a28320004
WIP 5 years ago
Manos Pitsidianakis fae1cdd33e
melib: Re-implement JWZ threading algorithm 5 years ago
Manos Pitsidianakis 4f715af248
melib: cache threads
closes #28
5 years ago
Manos Pitsidianakis bcef22b3f3
ui: add Listing component with 3 modes: compact plain and threaded 5 years ago
Manos Pitsidianakis 3e9d137310
melib: rework mail events
closes #39
5 years ago
Manos Pitsidianakis 8d3a2d8236
ui: refactor compose actions 5 years ago
Manos Pitsidianakis b94687cdb0
ui: add reply-context in compose
tracking-issue: #24
5 years ago
Manos Pitsidianakis 2b6d1e0dbf
Run clippy lints 5 years ago
Manos Pitsidianakis ad5d2353e8
Add plain threadview 5 years ago
Manos Pitsidianakis 710920c67b
Detect new mail events and pass them as notifications to State
concerns #26
5 years ago