Commit Graph

33 Commits

Author SHA1 Message Date
Manos Pitsidianakis
e8e7697001
terminal: fix edge case with strings/linebreaking
When printing and line-breaking a string in CellBuffer::write_string(),
the line should continue from the "beginning" of the previous one.
However it might be different than the offset of the first character of
the string, because it may be indented already.

This would result in awkward line breaks like:

            Available actions: [ list- |# end of terminal/border
            post, list-unsubscribe, lis|
            t-archive ]

This commit adds an extra argument to write_string() to specify the x
offset of the string, so that we can apply it while printing characters
but ignore it when the line changes; then the x coordinate will take the
value of the line_break value.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-30 13:58:56 +03:00
Manos Pitsidianakis
74f0d12afb
tools: remove obsolete imapshell.rs and smtp_conn.rs
Previous commits added shells in the main binary.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-29 22:47:35 +03:00
Manos Pitsidianakis
ae96038fbf
Make unicode-segmentation a hard dependency
meli/melib are UTF8 software, so we should have proper Unicode support.

A compile-time env var is added, `UNICODE_REGENERATE_TABLES` to force
network access and rebuild the cached unicode tables.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-04-11 21:15:47 +03:00
Manos Pitsidianakis
3e9144657b
meli: store children process metadata
Store children process metadata. Pid and command lines can then be shown
in the UI and in logs.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-03-23 10:43:58 +02:00
Manos Pitsidianakis
b8b24282a0
Update all instances of old domains with meli-email.org
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-03-10 21:38:12 +02:00
Manos Pitsidianakis
e19f3e572c
Cargo-sort all Cargo.toml files
With:

cargo sort  --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace meli
cargo sort  --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace melib
cargo sort  --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace tools
cargo sort  --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace fuzz

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-12-10 15:33:10 +02:00
Manos Pitsidianakis
3495ffd61b
types: Change UIEvent::Notification structure
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-12-02 17:20:39 +02:00
Manos Pitsidianakis
0a74c7d0e5
terminal/embedded: overhaul refactor
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-12-02 17:20:38 +02:00
Manos Pitsidianakis
0e3a0c4b70
Add safe UI widget area drawing API
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>
2023-12-02 17:20:37 +02:00
Manos Pitsidianakis
7645ff1b87
terminal/cells: rename write_string{to_grid,}
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-30 11:04:05 +02:00
Manos Pitsidianakis
e0adcdfe15
terminal/cells: move rest of methods under CellBuffer
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-30 11:04:05 +02:00
Manos Pitsidianakis
ab14f81900
terminal/cells: make write_string_to_grid a CellBuffer method
For future reference, refactoring was done with comby:

comby -review ":[w~\s]write_string_to_grid(:[s], &mut :[var],:[rest])" ":[var].write_string_to_grid(:[s],:[rest])" .rs
comby -review ":[w~\s]write_string_to_grid(:[s],:[var],:[rest])" ":[var].write_string_to_grid(:[s],:[rest])" .rs

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-30 11:04:05 +02:00
Manos Pitsidianakis
fa33a9468a
Move managesieve-client binary to tools/
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>
2023-11-22 15:10:23 +02:00
Manos Pitsidianakis
0e60bdf26e
Cargo.toml: add "iterator" feature to signal-hook
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>
2023-11-22 14:02:09 +02:00
Manos Pitsidianakis
2dc2940586
melib/build.rs: add feature to use cache instead of downloading unicode data
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-01 15:55:43 +03:00
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>
2023-08-21 12:45:15 +03:00
Manos Pitsidianakis
129f10911b
melib: rename imap_backend feature to imap 2023-07-22 20:46:23 +03:00
Manos Pitsidianakis
b0e867eb68
Move src to meli/src 2023-07-08 13:58:32 +03:00
Manos Pitsidianakis
0b258a1f05
meli: clippy lint fixes 2023-07-03 09:38:51 +03:00
Manos Pitsidianakis
5f29faa640
melib: clippy lint fixes 2023-07-03 09:38:47 +03:00
Manos Pitsidianakis
96537e48c5
Add {Timer,Component}Id wrapper types over Uuid 2023-06-17 21:02:07 +03:00
Manos Pitsidianakis
8f14a2373e
melib/imap: put imap-codec logic under the imap_backend feature 2023-06-17 20:10:23 +03:00
Manos Pitsidianakis
e0257c9d8d
Run cargo-sort 2023-06-04 21:13:55 +03:00
Manos Pitsidianakis
299c8e0f99
meli: restructure pub use melib::* imports 2023-06-04 21:13:54 +03:00
Manos Pitsidianakis
8c671935f9
Add compose (pre-submission) hooks for validation/linting
compose-hooks run before submitting an e-mail.
They perform draft validation and/or transformations.
If a hook encounters an error or warning, it will show up as a notification.
The currently available hooks are:
- past-date-warn
  Warn if Date header value is far in the past or future.
- important-header-warn
  Warn if important headers (From, Date, To, Cc, Bcc) are missing or invalid.
- missing-attachment-warn
  Warn if Subject, draft body mention attachments but they are missing.
- empty-draft-warn
  Warn if draft has no subject and no body.

They can be disabled with [composing.disabled_compose_hooks] setting.
2023-05-16 17:31:56 +03:00
Manos Pitsidianakis
b1a7188771
Clippy fixes 2023-04-30 20:47:53 +03:00
Manos Pitsidianakis
a73885acb1 Improve embed terminal
- Add character attribute support
- Add cursor key mode support
- Fix buggy set fg / bg sequences

And added a bin under tools to test arbitrary apps using the embedded
terminal:

 cargo run -p tools --bin embed -- "htop" 2> .htop.debug.log
2022-09-01 22:24:01 +03:00
Manos Pitsidianakis
721891c295 Update nom dependency 2022-05-02 17:04:13 +03:00
Manos Pitsidianakis
bcca9abe66
docs: Use example.com in documentation
Closes #96
2021-01-15 16:41:40 +02:00
Manos Pitsidianakis
a7c0bca8ce
Fix test errors and warnings 2020-11-21 02:09:18 +02:00
Manos Pitsidianakis
05e4dbcd5a
melib: update smol to 1.0.0 2020-09-18 21:06:33 +03:00
Manos Pitsidianakis
c6c0da7fcb
melib: cleanup commit
Cleanup melib module exports, add some document tests, change some
documentation.
2020-09-10 21:19:38 +03:00
Manos Pitsidianakis
6302d9d618
Rename testing crate to tools, and add README 2020-08-27 17:18:58 +03:00