Commit Graph

21 Commits (0e3a0c4b7049139994a65c6fe914dd3587c6713e)

Author SHA1 Message Date
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 6506fffb94
Rewrite email flag modifications
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 12m35s Details
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 14m2s Details
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>
2023-11-24 12:58:21 +02:00
Manos Pitsidianakis ac2a5dcdd1
melib: add display() method for Address
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-22 14:14:56 +02:00
Manos Pitsidianakis 0f3b529459
listing: hoist format_date() to ListingTrait method
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 19m32s Details
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 10m27s Details
For reusability.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-10-21 16:31:01 +03:00
Manos Pitsidianakis 714744366f
mail/listing: revert 22525d40 behavior when sidebar not focused
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-20 19:25:44 +02:00
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>
2023-09-14 15:08:44 +03:00
Manos Pitsidianakis 39e99770da
Use Context::current_dir() when saving files to relative paths
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 19m13s Details
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 19m19s Details
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-09 19:05:46 +03:00
Manos Pitsidianakis 54862f8651
listing.rs: add hide_sidebar_on_launch option
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-07 12:33:51 +03:00
Manos Pitsidianakis b673af02ac
accounts.rs: move to crate root
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-05 15:44:43 +03:00
Manos Pitsidianakis 1b3bebe304
view/thread: open earliest unread email instead of first in thread
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-02 19:04:35 +03:00
Manos Pitsidianakis 290cfb86c0
themes: add a highlighted_selected theme key
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 12m29s Details
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 12m40s Details
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>
2023-08-28 23:50:17 +03:00
Manos Pitsidianakis 31aa9ad29e
listing: autogen mbox filename when exporting mail to directories
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 8m9s Details
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 8m7s Details
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 18:20:38 +03:00
Manos Pitsidianakis 9037f08495
listing: replace hardcoded Key::{Home,End} values with shortcut values
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 9m23s Details
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 13m56s Details
Replace hardcoded Key::{Home,End} values with shortcut values
"home_page" and "end_page".

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-26 11:25:20 +03:00
Manos Pitsidianakis ffba203a3b
sidebar: add support for Home and End key navigation
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-26 11:17:21 +03:00
Manos Pitsidianakis 8551e1ba0b
clippy: fix new 1.72 default clippy lints
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 13m23s Details
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 9m16s Details
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-25 19:49:26 +03:00
Manos Pitsidianakis 96f0b3e6b4
components: fix shortcut section order
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 8m2s Details
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>
2023-08-21 14:53:29 +03:00
Manos Pitsidianakis 5c2b04719b
Normalize std::fmt::* imports
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Failing after 7m42s Details
2023-08-11 13:16:47 +03:00
Manos Pitsidianakis 7c9a4b4b7c
meli: Move components/mail -> mail 2023-08-11 13:01:32 +03:00