Commit Graph

8 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 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 688e39a67e
Fix clippy lints
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-22 14:05:59 +02:00
Manos Pitsidianakis f702dc220c
Fix new clippy lints.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-10-21 16:31:00 +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 f193bdf685
meli/jobs_view: add column headers and sorting
Sort with `sort <index> [asc/desc]` command or by pressing `1..5` keys.
Press them again to toggle between asc and desc.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-21 14:48:24 +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 005bf3881e
meli: Move components/utilities -> utilities 2023-08-11 12:46:16 +03:00