Commit Graph

885 Commits (8b6ea8de9a89b3ad42276eb7835992f7b875128b)

Author SHA1 Message Date
Manos Pitsidianakis 8b6ea8de9a
Remove ui crate
Merge ui crate with root crate.

In preparation for uploading `meli` as a separate crate on

Workspace crates will need to be published as well and having a separate
`ui` crate and binary perhaps doesn't make sense anymore.
2020-02-04 17:29:55 +02:00
Manos Pitsidianakis 6fcc792b83
Remove src/python
In preparation for publishing meli as a separate crate on

src/python was never used for anything, so remove it.
2020-02-04 17:29:50 +02:00
Manos Pitsidianakis 6b15c71f83
Don't run test_escape_str without $DISPLAY set 2020-02-04 03:49:43 +02:00
Manos Pitsidianakis 7d6526dede
ui: add BraillePixelIter
Iterate on 2x4 pixel blocks from a bitmap and return a unicode braille character for each
block. The iterator holds four lines of bitmaps encoded as `u16` numbers in swapped bit
order, like the `xbm` graphics format. The bitmap is split to `u16` columns.

/* BEE is the contents of a 48x48 xbm file. xbm is a C-like array of 8bit values, and
 * each pair was manually (macro-ually?) condensed into a single 16bit value. Each 3 items
 * represent one pixel row.
const BEE: [u16; 3 * 48] = [
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0002, 0x0000, 0x0000, 0xe003, 0x0000, 0x0000, 0xfc00, 0x0000, 0x0000, 0x3f00,
    0x0000, 0x00e0, 0x0f00, 0x0000, 0x00f8, 0x0300, 0x0000, 0x00fe, 0x0000, 0x0080, 0x8f0d,
    0x0000, 0x00e0, 0xff7f, 0x0000, 0x00f8, 0xffff, 0x0300, 0x00fc, 0xffff, 0x0f00, 0x00fe,
    0xffff, 0x3f00, 0x00ff, 0xffff, 0xff00, 0xc0ff, 0xffff, 0xff01, 0xc0ff, 0xff77, 0xff07,
    0xf0f9, 0xffff, 0xff07, 0xf0f0, 0xffef, 0xfd0f, 0xf0e0, 0xffff, 0xfb1f, 0xf0e1, 0xffc1,
    0xfb0f, 0xe0f3, 0xffc3, 0xf307, 0xc0f7, 0xffc0, 0xe100, 0xc0ff, 0xd9e0, 0x3f00, 0x803e,
    0xc1f8, 0x5f00, 0x8076, 0x43f4, 0xbf18, 0x806c, 0x43fc, 0xf325, 0x0009, 0xc3df, 0x4326,
    0x001a, 0xcf3f, 0x622d, 0x0034, 0xff01, 0x2224, 0x00f0, 0xff00, 0x8312, 0x00a0, 0x5700,
    0x0309, 0x00f8, 0x1b00, 0x8f06, 0x0048, 0x6000, 0xcd03, 0x0018, 0x6624, 0xdf00, 0x0030,
    0x820f, 0x3f00, 0x00c0, 0xf0ff, 0x3f00, 0x0080, 0x03fe, 0x7f00, 0x0000, 0x7ce0, 0x0f00,
    0x0000, 0x809f, 0x1c00, 0x0000, 0x0000, 0x3800, 0x0000, 0x0000, 0x7000, 0x0000, 0x0000,

for lines in BEE.chunks(12) {
    let iter = ui::BraillePixelIter::from(lines);
    for b in iter {
        print!("{}", b);


2020-02-04 02:58:24 +02:00
Manos Pitsidianakis 5e67bc4d11
Rename `mime_apps` dependency to `xdg-utils`
Upstream's name was changed.
2020-02-04 02:58:24 +02:00
Manos Pitsidianakis af4c5792b3
ui: remove unnecessary unreachable panics in set_and_join_box 2020-02-04 02:58:24 +02:00
Manos Pitsidianakis bc98a0ef48
Makefile: make Makefile portable
Tested with
- GNU Make 4.2.1
- bmake 20160220-2+b1
2020-02-04 02:58:21 +02:00
Manos Pitsidianakis bb80de91ae
Makefile: add debian/ and deb-dist target to build *.deb package 2020-02-04 02:55:45 +02:00
Manos Pitsidianakis cd1ed5ef40
melib/mbox: replace unimplemented!() with Error 2020-01-31 03:54:58 +02:00
Manos Pitsidianakis 51d9405c72
melib/mbox: fix parse error
First line of an mbox message is a "From ..." header without the colon
required in RFC822. Skip it when parsing the actual e-mail.

This was lost somewhere in the commit history when mbox was added,
2020-01-31 03:54:58 +02:00
Manos Pitsidianakis 6a096dd405
Add missing copyright preambles 2020-01-31 03:54:58 +02:00
Manos Pitsidianakis 901cc3494f
ui/themes: add theming support in tab bar 2020-01-31 03:54:58 +02:00
Manos Pitsidianakis e3cd33f0e3
Update Makefile
- Add BINDIR, MANDIR env vars
- add check-dep target that checks for cargo/rustc version
- add ANSI formatting output with NO_COLOR support
- add help target
- move manpage installation to install-doc target
- move bin installation to install-bin target
- add dist target
- add warning if BINDIR is not inside $PATH
- add warning if MANDIR is not inside $MANPATH/manpath
2020-01-31 03:54:58 +02:00
Manos Pitsidianakis f55311bfbd
meli-themes.5: split tables into pages
This seems to be a bug with debian's  troff renderer; tables spanning
more than one page were silently dropped and were not visible.

tbl(1) says to use the macro .TS H with .TH to define the headers but
this is not supported in debian nor openbsd's mandoc implementation.
2020-01-29 21:25:00 +02:00
Manos Pitsidianakis 43395461dd
ui/conf: replace include macro with m4 include macro 2020-01-29 05:54:13 +02:00
Manos Pitsidianakis 60457725a4
Correct mdoc lint warnings 2020-01-28 18:43:14 +02:00
Manos Pitsidianakis dbc0fd81af
Rename config file to config.toml 2020-01-28 18:41:50 +02:00
Manos Pitsidianakis 449e526953
Add meli-themes.5 doc, update others 2020-01-28 00:32:40 +02:00
Manos Pitsidianakis 6a7cae0988
ui/themes: add NO_COLOR support
2020-01-27 20:17:46 +02:00
Manos Pitsidianakis ee65f355c7
ui/themes: print theme name that contains error in Theme::validate 2020-01-27 17:35:32 +02:00
Manos Pitsidianakis f15e569627
ui/themes: add status.{bar,notification} and theme_default keys
- theme_default replaces general for all default colors/attributes
- add status.{bar,notification} support
2020-01-27 17:35:13 +02:00
Manos Pitsidianakis 5dc477bcd5
Fix some unused etc warnings 2020-01-27 17:32:12 +02:00
Manos Pitsidianakis b823969ae2
small fixes
- Don't debug print Timer events in src/ 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
2020-01-27 17:15:29 +02:00
Manos Pitsidianakis 3c7328d901
ui: correctly turn on/off terminal attributes in draw_horizontal_segment()
`Attr` (terminal attributes such as bold, underline, etc) were not being
printed properly: their bitmap representation was printed instead of the
correct ANSI codes to turn them on/off. This worked so far because the
attributes and {fore,back}ground color was reset in every character

draw_horizontal_segment() now keeps state of current_{fg,bg,attr} to
keep from resetting in each column draw.
2020-01-27 17:07:29 +02:00
Manos Pitsidianakis 77d9cef6fc
melib/imap: small fixes
- Ignore final line ("M__ OK ...") when parsing FETCH response.

- Remove unnecessary import and reword some error messages
2020-01-27 15:55:01 +02:00
Manos Pitsidianakis 254028fa47
melib/threads: fix thread splintering case when inserting reply
When inserting reply, its thread group was re-inserted with the reply as
the root. This is a mistake as threads should never be re-inserted, only
2020-01-27 14:34:25 +02:00
Manos Pitsidianakis 8ec82b836a
Add 2 theme-related cli flags 2020-01-24 16:15:31 +02:00
Manos Pitsidianakis 5230ce2d03
ui/themes: load other themes from ./themes/ dir 2020-01-24 16:05:25 +02:00
Manos Pitsidianakis ab0b4f5168
ui/themes: add defaults in add!() macro 2020-01-24 09:20:26 +02:00
Manos Pitsidianakis eedb03dcd0
ui/themes: fix attr parsing not recognizing links 2020-01-24 09:19:57 +02:00
Manos Pitsidianakis fc4b9f8919
ui/themes: add other_themes field to Theme
Add support for multiple arbitrarily named themes.
2020-01-24 09:18:43 +02:00
Manos Pitsidianakis 72e1d5d52d
ui/themes: add link cycle detection in theme validation 2020-01-24 02:29:41 +02:00
Manos Pitsidianakis 2a4ecc8314
Micro fix in meli.conf.5 2020-01-24 01:31:23 +02:00
Manos Pitsidianakis 1e2b3c073d
ui/themes: add ThemeAttribute
Consolidate {fg,bg} color theme settings to ThemeAttribute and add Attr
(bold, etc).
2020-01-23 19:52:54 +02:00
Manos Pitsidianakis f787eb75b6
ui/themes: add ThemeValue struct
ThemeValue is either a Color or a theme key, meaning the value is linked
to another key's value.
2020-01-22 00:06:14 +02:00
Manos Pitsidianakis aa04ddda3d
ui/themes: add envelope view headers/body theme colors 2020-01-22 00:05:26 +02:00
Manos Pitsidianakis dc63e1f657
Minor changes 2020-01-22 00:04:14 +02:00
Manos Pitsidianakis 1e2acd3b29
melib: add complete() method to ShellExpandTrait
complete(force: bool) returns String path segments that when appended to
the path will form a valid location. Example:

  - User types: save-attachment 1 /t
  - User presses <TAB>.
  - complete() returns the suggestion: "mp/"
  - User sees: save-attachment 1 /tmp/

complete() uses openat() and getdents64 syscalls hoping it's faster than
using stdlib.
2020-01-21 12:02:21 +02:00
Manos Pitsidianakis 6d9f584de3
Update nix to 0.16.1 2020-01-21 12:02:21 +02:00
Manos Pitsidianakis a1c449e585
ui/themes: add theming to ConversationsListing, sidebar 2020-01-21 12:02:21 +02:00
Manos Pitsidianakis a9842cacee
ui: add theming support
Configuration flag "terminal.themes" has two default theme entries,
"dark" and "light".

This commit alters only CompactListing for theme support.
2020-01-21 12:02:21 +02:00
Manos Pitsidianakis 63ff25b36a
ui/listings: add folder_hash field
No reason not to have it stored and discover it whenever it's needed.
2020-01-20 16:03:29 +02:00
Manos Pitsidianakis e07b5faf6e
melib/threads: already-exists check in threads insert 2020-01-20 16:03:29 +02:00
Manos Pitsidianakis 350fafb515
melib/thread: add attachments field to Thread 2020-01-20 16:03:06 +02:00
Manos Pitsidianakis 5e68d600b9
melib/threads: Split ThreadGroup::Group to Thread
Create Thread struct.
2020-01-20 16:03:06 +02:00
Manos Pitsidianakis d9269335a1
melib/threads: rename thread hashes
- Rename ThreadHash to ThreadNodeHash
- Rename ThreadGroupHash to ThreadHash
2020-01-20 16:03:06 +02:00
Manos Pitsidianakis 47a69f8eb9
melib: add ThreadGroup
Instead of using Union/Find to gather mail that belongs in the same
e-mail thread together, add a new entity ThreadGroup that ThreadNodes
point to. ThreadGroup represents an actual Thread: A thread root
ThreadGroup::Group or a reply ThreadGroup::Node.

To make semantics more accurate:

- ThreadNode hash should be renamed to ThreadNodeHash
- ThreadGroupHash should be renamed to ThreadHash
- ThreadGroup::Group should be a struct named Thread instead
- move ThreadGroup::Node logic to ThreadNode akin to Union/Find
- rename ThreaddGroup::Group to Thread
2020-01-20 16:03:06 +02:00
Manos Pitsidianakis 20f86f2741
ui/listing: add mailbox reload rate limit 2020-01-20 16:03:06 +02:00
Manos Pitsidianakis 0ac10aa4d0
Some listing refactoring 2020-01-20 16:03:06 +02:00
Manos Pitsidianakis f58ed387dd
ui: add ratelimiting in UI notifications and drawing 2020-01-20 16:03:06 +02:00