Commit graph

371 commits

Author SHA1 Message Date
Florian Dehau
ae677099d6 feat(widgets/table): allow one row to be selected 2020-03-13 00:36:19 +01:00
Florian Dehau
140db9b2e2 refactor(canvas): update shape drawing strategy
* Update the `Shape` trait. Instead of returning an iterator of point, all
shapes are now aware of the surface they will be drawn to through a `Painter`.
In order to draw themselves, they paint points of the "braille grid".
* Rewrite how lines are drawn using a common line drawing algorithm (Bresenham).
2020-03-12 23:14:46 +01:00
Florian Dehau
a6b35031ae chore: use master branch instead of latest release for crossterm
This will prevent [this](https://github.com/crossterm-rs/crossterm/pull/383)
descriptor leak bug when people use the crossterm backend with the current
master.
2020-03-12 22:44:43 +01:00
hatoo
004cf2687a Add oha to the "apps using tui" list 2020-03-12 22:28:11 +01:00
Clement Tsang
cf8db5ea23 Add bottom to the "apps using tui" list 2020-03-05 23:00:41 +01:00
Vadim Chekan
1683e8d609
Clean redundant generics params in Table (#234)
* Clean redundant generics params in Table

It is possible to use associated types the same way as generics parameters. In fact associated types are nothing more than better organized generics params. For example, there is no need to introduce another param to constraint iterator item to be Display, you can just say `where I::Iterator, I::Item: Display`. This allows to drop type params for Table from 5 to 2.
2020-03-03 09:21:45 +01:00
Benjamin Vaisvil
f372e034e8 added to Apps using tui 2020-03-03 09:15:56 +01:00
Florian Dehau
8c3db49fba chore: bump crossterm to 0.16 2020-02-23 20:14:46 +01:00
Florian Dehau
02b1aac0b0 chore: remove outdated badges 2020-02-23 20:14:14 +01:00
Florian Dehau
6cb57f5d2a feat: add stateful widgets
Most widgets can be drawn directly based on the input parameters. However, some
features may require some kind of associated state to be implemented.

For example, the `List` widget can highlight the item currently selected. This
can be translated in an offset, which is the number of elements to skip in
order to have the selected item within the viewport currently allocated to this
widget. The widget can therefore only provide the following behavior: whenever
the selected item is out of the viewport scroll to a predefined position (make
the selected item the last viewable item or the one in the middle).
Nonetheless, if the widget has access to the last computed offset then it can
implement a natural scrolling experience where the last offset is reused until
the selected item is out of the viewport.

To allow such behavior within the widgets, this commit introduces the following
changes:
- Add a `StatefulWidget` trait with an associated `State` type. Widgets that
can take advantage of having a "memory" between two draw calls needs to
implement this trait.
- Add a `render_stateful_widget` method on `Frame` where the associated
state is given as a parameter.

The chosen approach is thus to let the developers manage their widgets' states
themselves as they are already responsible for the lifecycle of the wigets
(given that the crate exposes an immediate mode api).

The following changes were also introduced:

- `Widget::render` has been deleted. Developers should use `Frame::render_widget`
instead.
- `Widget::background` has been deleted. Developers should use `Buffer::set_background`
instead.
- `SelectableList` has been deleted. Developers can directly use `List` where
`SelectableList` features have been back-ported.
2020-02-23 19:23:37 +01:00
Florian Dehau
67dd1ac608 fix: remove array_into_iter warnings 2020-02-23 16:20:54 +01:00
Malte Tammena
808a5c9ffd Mark Style::* functions const 2020-02-23 15:58:37 +01:00
Florian Dehau
d16db5ed90 style: fix clippy warnings 2020-02-23 15:46:46 +01:00
Florian Dehau
6e24f9d47b style: run cargo fmt 2020-02-23 15:46:30 +01:00
tarkah
92ab09496a add ytop to apps using 2020-02-23 15:40:55 +01:00
Florian Dehau
28017f97ea feat(widgets/chart): add more control on the visibility of the legend 2020-02-23 15:37:50 +01:00
Florian Dehau
ea43413507 fix: remove clippy warnings 2020-01-19 23:11:12 +01:00
Caleb Bassi
829b7b6b70 Change linechart to draw the points also 2020-01-19 21:25:17 +01:00
Caleb Bassi
262bf441ce Add linechart support
Closes #73

This commit only adds support for linecharts for the braille marker.
2020-01-19 21:25:17 +01:00
Caleb Bassi
7aae9b380e Add header_gap field to Table 2020-01-19 20:30:28 +01:00
Florian Dehau
d50327548b style: run rustfmt 2020-01-19 18:44:00 +01:00
Florian Dehau
e6ce0ab9a7 refactor(examples): add input modes to user input examples 2020-01-19 18:41:00 +01:00
Florian Dehau
9085c81e76 refactor: clean up border type for blocks
* Merge line symbols in a single module.
* Replace set_border_type with border_type to match other builder methods.
* Remove unecessary branching.
2020-01-19 15:44:03 +01:00
Matthew Stevenson
682349c03e update block example; add BorderType to exposed widgets API 2020-01-19 15:17:59 +01:00
Matthew Stevenson
a72389b28c revert to single Block struct; add set_border_type method and BorderType enum 2020-01-19 15:17:59 +01:00
Matthew Stevenson
f1bc00b67f add rounded corners and double borders to block example 2020-01-19 15:17:59 +01:00
Matthew Stevenson
06d159fb7b add RoundedBlock and DoubleBlock structs that impl From Block; add Block::rounded() and Block::double_border() 2020-01-19 15:17:59 +01:00
Matthew Stevenson
578560766d add round corners and double lines to symbols 2020-01-19 15:17:59 +01:00
Caleb Bassi
9e5c924ef1 Fix crossterm link in readme 2020-01-19 15:09:12 +01:00
Aram Drevekenin
cf39de882a docs(readme): add bandwhich to "apps using tui" 2020-01-19 15:08:04 +01:00
Florian Dehau
8293cef703 Release v0.8.0 2019-12-15 23:12:55 +01:00
Timon
60b99cfc66 feat: bump crossterm to 0.14 2019-12-15 23:03:02 +01:00
Florian Dehau
7cc4189eb0 chore: update issue templates 2019-12-13 21:32:20 +01:00
Florian Dehau
86d4a32314 chore: update issue templates 2019-12-13 21:30:07 +01:00
Florian Dehau
67c9c64eab chore: add spotify-tui to the list of apps using tui 2019-12-13 21:19:34 +01:00
Kyle Ruzic
b8d0f947e8 Added a verticle 'cross' to the symbols as it was missing for no real reason 2019-12-13 20:36:08 +01:00
Sebastian Woetzel
bbd4363fa9 Bugfix: title_style was not used to style the axis title 2019-12-13 20:26:20 +01:00
Florian Dehau
e0083fb8de chore: make the onboarding easier for Windows users. 2019-12-13 20:19:59 +01:00
Florian Dehau
3abafc307c Release v0.7.0 2019-11-29 10:05:06 +01:00
Florian Dehau
055af0f78a chore: bump dev dependencies
* bump rand to 0.7
* bump structopt to 0.3
2019-11-29 09:20:31 +01:00
Timon
e4873e4da9 feat(backend): bump crossterm to 0.13
* removed flush calls because execute already calls flush under the hood.
* moved some static functions into From traits
* removed useless clone in demo
* upgrade to crossterm 0.13
* map all errors
2019-11-29 09:06:59 +01:00
Florian Dehau
2233cdc9cc chore: add CI based on github actions 2019-11-05 09:10:57 +01:00
Florian Dehau
816bc9b5c8 style: fix formatting and clippy issues 2019-11-05 08:08:14 +01:00
Florian Dehau
a82c82fcd7 fix(widgets): remove compilation warning in table widget 2019-10-31 09:27:08 +01:00
TheZoq2
bb28d02277 Update docs to point encourage installing 0.6 2019-10-31 09:18:51 +01:00
Jeffas
94877f4e7e Use constraints for table column widths
This allows table column widths to be adapted more and scale with the
UI.

The constraints are solved using the Cassowary solver. An added
constraint for fitting them all in the width is added.
2019-10-31 09:18:24 +01:00
Florian Dehau
3747ddbefb feat(backend): Refactor crossterm backend
* Remove compilation warnings
* Fix rendering artifacts in the crossterm demo. In particular, the bold modifier
was leaking on most of the terminal screen because the old logic was not
properly unsetting the bold modifier after use (took inspiration of the termion
backend implementation)
2019-10-31 09:17:47 +01:00
Florian Dehau
42731da546 Enable build failure on compilation warnings 2019-10-31 09:17:47 +01:00
Joseph Knight
e183d63a5e typo in barcharg.rs 2019-08-11 14:03:58 +02:00
Joseph Knight
e5fdd442c3 typo in sparkline.rs 2019-08-11 14:03:58 +02:00