Commit Graph

56 Commits (80a929ccc65c03fd751f150145807b32f26d60af)

Author SHA1 Message Date
JerzySpendel 80a929ccc6
chore: fix typo (#513) 3 years ago
Florian Dehau 5ea54792c0 refactor(widgets/table): more flexible table
- control over the style of each cell and its content using the styling capabilities of Text.
- rows with multiple lines.
- fix panics on small areas.
- less generic type parameters.
4 years ago
Florian Dehau 5050f1ce1c feat(widgets/gauge): add `LineGauge` variant of `Gauge` 4 years ago
Florian Dehau 88c4b191fb feat(text): add new text primitives 4 years ago
Brooks Rady 112d2a65f6
feat(widgets/paragraph): add option to preserve indentation when the text is wrapped (#327) 4 years ago
Alexander Batischev 8c2ee0ed85
feat(terminal): Add after-draw() cursor control to Frame (#91) (#309) 4 years ago
Florian Dehau 5d99b4af00 docs: improve widgets documentation 4 years ago
Florian Dehau bc2a512101 feat: add missing `Clone` and `Copy` on types 4 years ago
Florian Dehau 584e1b0500 refactor(widgets/canvas): allow canvas to render with a simple dot character instead of braille patterns
This change allows developers to gracefully degrade the output if the targeted
terminal does not support the full range of unicode symbols.
4 years ago
Stephan Dilly 7676d3c7df add clear widget and popup example utilizing it 4 years ago
Florian Dehau ae677099d6 feat(widgets/table): allow one row to be selected 4 years ago
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.
4 years ago
Caleb Bassi 262bf441ce Add linechart support
Closes #73

This commit only adds support for linecharts for the braille marker.
4 years ago
Matthew Stevenson 682349c03e update block example; add BorderType to exposed widgets API 4 years ago
Florian Dehau 2a7eec816a Add PartialEq to Text 5 years ago
Florian Dehau 8fbb764c9e Move Borders documentation 5 years ago
DarrienG 41cdd3e261 Provide clone and debug for Text type 5 years ago
Florian Dehau b669cf9ce7 style: fix clippy warnings 5 years ago
Sven-Hendrik Haase 144bfb71cf Upgrade to 2018 edition 5 years ago
Karoline Pauls 10642d0e04 Paragraph: word wrapping 6 years ago
Antoine Büsch f795173886 Unify Item and Text 6 years ago
Antoine Büsch e42ab1fed8 Move Text to widgets/mod.rs 6 years ago
Florian Dehau d6016788ef refactor: clippy + rustfmt 6 years ago
Florian Dehau ad602a54bf refactor(widgets): replace text rendering in Paragraph
* remove custom markup language
* add Text container for both raw and styled strings
6 years ago
Florian Dehau 7181970a32 feat: split layout from rendering
* remove layout logic from Terminal
* replace Group with Layout
* add Frame intermediate object
6 years ago
Florian Dehau 36a5eb2110 Format code 6 years ago
Florian Dehau 151d7e8a1c [src] Update dependencies
* Update all dependencies to their latest versions
* Change border to Borders to match v1.0 of bitflags
7 years ago
Florian Dehau 1f285fbac0 [src] Run cargo fmt 7 years ago
talha 3045ac4124 Minor codestyle fixes 7 years ago
Florian Dehau ca3308e945 [widgets] Fix Row export 7 years ago
Florian Dehau 89a173fe9b Refactor List Widget
* Add a generic item object for the list. The item can either be some data
alone or some data and its style
* The List widget now store an Iterator over those element. This should
avoid the need of allocating memory to store its elements
* The List consume the Iterator when it is drawn
7 years ago
Florian Dehau b1737ce667 Update Widget Trait
The draw function now take a &mut reference to the widget, allowing the
widget to modify itself when drawn. This change the semantic of the draw
call since the widget should now be considered "consumed" after it.
7 years ago
Florian Dehau feefa5d54f Convert backends to conditionnal features for compilation 8 years ago
Florian Dehau ad239ef23c Update list and table to be more flexible
* Move List to SelectableList
* Create a more generic List
* Change the way to pass items to the table widget
* Update demo
8 years ago
Florian Dehau 224eb2d8e0 Add support for text styling 8 years ago
Florian Dehau 9bc61551e2 Refactor Terminal to be able to support multiple backends
* Add Rustbox as an other possible backend
8 years ago
Florian Dehau 652ff12380 More documentation 8 years ago
Florian Dehau 93cc237007 Documentation 8 years ago
Florian Dehau a5b632aeb0 Cleanup API 8 years ago
Florian Dehau a36e20f217 Add background_color support for all existing wigets 8 years ago
Florian Dehau cd919e69f5 Fix some display errors 8 years ago
Florian Dehau 654be037be Redefine canvas widget and add shapes
* Give the canvas widget a proper modules and define a standard way to
draw to it (Shape trait)
* Add Points, Line, Rectangle and Map shapes
8 years ago
Florian Dehau f0979dfeee Improve canvas functionalities and fix clippy warnings 8 years ago
Florian Dehau c862fa9ce3 Add Map widget 8 years ago
Florian Dehau 7bdb11c681 Add Canvas widget
* Add a canvas widget to draw shapes using braille dots
* Use this widget in the chart widget when the braille mode is selected
8 years ago
Florian Dehau 95a160cf50 Add braille mode for the chart widget 8 years ago
Florian Dehau c91436baee Change rendering method and adapt widget trait accordingly 8 years ago
Florian Dehau 063bde8764 Add bar chart prototype 8 years ago
Florian Dehau 15c3471f0b Fix clippy warnings 8 years ago
Florian Dehau 07ff2b08eb Improve Chart Widget, safer buffer and unicode width 8 years ago