Commit graph

449 commits

Author SHA1 Message Date
Florian Dehau
a7c21a9729 fix(widgets): avoid offset panic in Table and List when input changes 2021-08-01 18:01:24 +02:00
Florian Dehau
914d54e672 chore: bump crossterm to 0.20 2021-08-01 17:14:11 +02:00
Florian Dehau
a68e38e59e fix(table): use Layout in table column widths computation 2021-08-01 16:46:54 +02:00
Florian Dehau
e870e5d8a5 feat(layout): add private option to control last chunk expansion 2021-08-01 16:46:54 +02:00
Florian Dehau
8eb6336f5e refactor(widgets): remove iter::repeat for blank symbols 2021-08-01 15:08:53 +02:00
Florian Dehau
34a2be6458 fix(widgets/chart): remove panics with long axis labels 2021-08-01 15:08:53 +02:00
Florian Dehau
fbd834469f doc(widgets/clear): clarify usage of clear 2021-06-16 21:58:04 +02:00
Florian Dehau
38dcddb126 fix(widgets/gauge): apply label style and avoid overflow on large labels 2021-06-16 20:24:14 +02:00
jmrgibson
a5f7019b2a
doc: fix minor grammatical errors (#489)
A missing "and" after "an" (which I do all the time) and some tense clarification.
2021-06-16 17:15:13 +02:00
Oleks (オレクス)
a346704cdc
feat(block): add option to center and right align the title (#462)
* Added ability to set title alignment, added tests, modified blocks example to show the feature

* Added test for inner with title in block

* Updated block example to show center alignment

* Formatting fixed

* Updated tests to use lamdas and be more concise. Updated title alignmnet code to be more straightforward and have correct behavior when placing title in the center without left border
2021-05-22 16:55:24 +02:00
Andrew Chin
24396d97ed doc: Add doctests that shows how Text can be created from Cow<str> 2021-05-22 16:47:06 +02:00
Andrew Chin
703e41cd49 feat(Text): Add a From<Cow<str>> impl for Text 2021-05-22 16:47:06 +02:00
Florian Dehau
975c4165d0 chore: fix clippy warnings 2021-05-22 15:54:38 +02:00
Alexandru Scvortov
d47565be5c
fix: actually clear buffer in TestBackend::clear (#461) 2021-05-02 22:35:08 +02:00
Florian Dehau
90a6a8f2d6 Release v0.15.0 2021-05-02 19:03:01 +02:00
Joey Ezechiëls
3a843d5074
fix(test): remove compile warning in TestBackend::assert_buffer (#466) 2021-05-02 18:27:47 +02:00
Simas Toleikis
8832281dcf Update crossterm to 0.19. 2021-01-04 23:26:04 +01:00
Florian Dehau
853f3d9200 feat(terminal): add a read-only view of the terminal state after the draw call 2021-01-04 22:18:28 +01:00
Florian Dehau
f09863faa0 Release v0.14.0 2021-01-01 14:51:08 +01:00
Florian Dehau
eb1e3be722 fix(widgets/block): make Block::inner return more accurate results on small areas 2020-12-13 17:21:10 +01:00
Vadim Chekan
74243394d9
fix(widgets/table): draw table header and border even if rows are empty (#426) 2020-12-08 21:49:16 +01:00
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.
2020-11-29 23:47:58 +01:00
Florian Dehau
79e27b1778 refactor(widgets/gauge): stop using unicode blocks by default 2020-11-29 19:27:34 +01:00
DashEightMate
0a05579a1c
feat(widgets/gauge): allow gauge to use unicode block for more descriptive progress (#377)
* gauge now uses unicode blocks for more descriptive progress

* removed unnecessary if

* changed function name to better reflect unicode

* standardized block symbols, added no unicode option, added tests

* formatting

* improved readability

* gauge tests now check color

* formatted
2020-11-29 19:20:08 +01:00
pm100
5bf40343eb
fix(widgets/paragraph): handle trailing nbsp in wrapped text (#405) 2020-11-15 20:03:33 +01:00
Florian Dehau
1e35f983c4 doc(style): improve documentation of Style 2020-11-14 21:29:56 +01:00
Florian Dehau
a15ac8870b feat(style): add a method to create a style that reset all properties until that point 2020-11-14 21:29:56 +01:00
Florian Dehau
8a27036a54 fix(widgets/block): allow Block to render on small areas 2020-11-14 20:32:10 +01:00
Florian Dehau
8543523f18 Release v0.13.0 2020-11-14 17:37:21 +01:00
acheronfail
5a9b59866b feat(widgets/listitem): derive PartialEq 2020-11-14 16:51:19 +01:00
Kemyt
98fb5e4bbd
fix(widgets/table): take borders into account when percentage and ration constraints are used (#385)
* Fix percentage and ratio constraints for table to take borders into account

Percentage and ratio constraints don't take borders into account, which causes
the table to not be correctly aligned. This is easily seen when using 50/50
percentage split with bordered table. However fixing this causes the last column
of table to not get printed, so there is probably another problem with columns
width determination.

* Fix rounding of cassowary solved widths to eliminate imprecisions

* Fix formatting to fit convention

Co-authored-by: Kemyt <kemyt4@gmail.com>
2020-11-14 16:45:36 +01:00
Sebastian Thiel
25ff2e5e61 upgrade crossterm to v0.18
It reduces the amount of dependencies, among other improvements.
2020-09-29 23:28:45 +02:00
Florian Dehau
5050f1ce1c feat(widgets/gauge): add LineGauge variant of Gauge 2020-09-28 00:40:19 +02:00
Florian Dehau
51b691e7ac Release v0.12.0 2020-09-27 19:55:45 +02:00
Florian Dehau
c4cd0a5f31 fix(widgets/chart): use the correct style to draw legend and axis titles
Before this change, the style of the points drawn in the graph area could reused to draw the
title of the axis and the legend. Now the style of these components put on top of the graph area
is solely based on the widget style.
2020-09-27 19:12:35 +02:00
Florian Dehau
41142732ec feat(buffer): add a method to build a Style out of an existing Cell 2020-09-27 19:12:35 +02:00
Kemyt
62495c3bd1
fix(widgets/barchart): fix chart filled more than actual (#383)
* Fix barchart incorrectly showing chart filled more than actual

Determination of how filled the bar should be was incorrectly taking the
entire chart height into account, when in fact it should take height-1, because
of extra line with label. Because of that the chart appeared fuller than it
should and was full before reaching maximum value.

* Add a test case for checking if barchart fills correctly up to max value

Co-authored-by: Kemyt <kemyt4@gmail.com>
2020-09-27 17:15:44 +02:00
Brooks Rady
d00184a7c3
feat(text): extend Text to be stylable and extendable (#361)
* Extend `Text` to be extendable
* Add some documentation
2020-09-27 14:20:14 +02:00
Brooks Rady
ce32d5537d
chore: clippy fixes (#386) 2020-09-27 13:41:28 +02:00
Florian Dehau
57862eeda6 Release v0.11.0 2020-09-20 16:34:44 +02:00
Brooks Rady
0abaa20de9
refactor: clean up some folds (#362) 2020-09-20 15:02:06 +02:00
Amjad Alsharafi
c35a1dd79f
feat(widgets/canvas): added type Block in canvas markers (#350)
This allows for clearer colors than using Dot, especially when
decreasing the size of the terminal font in order to increase the
resolution of the canvas
2020-09-20 14:57:35 +02:00
alvinhochun
e0b2572eba
refactor(backend/crossterm): support more style modifiers on Windows and fix build with Crossterm 0.17.8 (#368)
* Support more style modifiers on Windows
* Change Crossterm backend to write directly to buffer instead of String

Crossterm might actually do WinAPI calls instead of writing ANSI excape
codes so writing to an intermediate String may cause issues on older
versions of Windows. It also fails to compile with Crossterm 0.17.8 due
to Crossterm now expecting the writer to support `flush`, which String
doesn't.

Fixes #373
2020-09-20 14:54:16 +02:00
Florian Dehau
90f3858eff feat(backend): keep the internal buffers in sync when the terminal is cleared. 2020-08-23 21:13:12 +02:00
Florian Dehau
ecb482f297 fix(backend): move the cursor when first diff is on second cell
Both termion and crossterm backends were not moving the cursor if the first diff to draw was on the
second cell. The condition triggering the cursor move has been updated to fix this. In addition, two
tests have been added to avoid future regressions.
2020-08-02 21:10:44 +02:00
Florian Dehau
641f391137 feat(terminal): add unstable api to use a fixed viewport
There was now way to avoid the autoresize behavior of `Terminal`. While it was fine for most users,
it made the testing experience painful as it was impossible to avoid the calls to `Backend::size()`.
Indeed they trigger the following error: "Inappropriate ioctl for device" since we are not running
the tests in a real terminal (at least in the CI).

This commit introduces a new api to create a `Terminal` with a fixed viewport.
2020-08-02 20:46:57 +02:00
Florian Dehau
6504930888 Release v0.10.0 2020-07-18 18:03:32 +02:00
Florian Dehau
0ffea495b1 refactor: implement cascading styles
- merge `Style` and `StyleDiff` together. `Style` now is used to activate or deactivate certain
style rules not to overidden all of them.
- update all impacted widgets, examples and tests.
2020-07-17 20:58:20 +02:00
Florian Dehau
88c4b191fb feat(text): add new text primitives 2020-07-10 22:59:24 +02:00
Brooks Rady
112d2a65f6
feat(widgets/paragraph): add option to preserve indentation when the text is wrapped (#327) 2020-07-07 00:10:24 +02:00
Xiaopeng Li
d999c1b434
feat(widgets/paragraph): Add horizontal scroll (#329)
* `Paragraph:scroll` takes a tuple of offsets instead of a single vertical offset.
* `LineTruncator` takes this new horizontal offset into account to let the paragraph scroll horizontally.
2020-07-06 23:47:52 +02:00
Mikko Rantanen
3aa8b9a259 Implement patch between two StyleDiff 2020-07-05 18:32:33 +02:00
Florian Dehau
fdbea9e2ee fix(widgets/canvas): avoid panic on zero-width bounds 2020-07-05 14:02:11 +02:00
Alexander Batischev
8c2ee0ed85
feat(terminal): Add after-draw() cursor control to Frame (#91) (#309) 2020-06-15 22:57:23 +02:00
Florian Dehau
7251186762 feat(style): add StyleDiff 2020-06-08 23:55:23 +02:00
Florian Dehau
82fda4ac0e doc(style): improve documentation of Style 2020-06-08 23:55:23 +02:00
Kenta Iwasaki
1d12ddbdfc layout: add vertical split constraint test on height 2020-06-08 23:05:08 +02:00
Kenta Iwasaki
f474c76e19 layout: force constraint that width and height are non-negative 2020-06-08 23:05:08 +02:00
Florian Dehau
ac99104114 feat(style): add support to serialize and deserialize Style using serde
* Add serde as an optional dependency.
* Add feature-gated derives to Color, Modifier and Style.
2020-05-28 01:08:40 +02:00
Paul Horn
0bb9b388f7 Borrow layout for splitting instead of moving it
This allows for layouts to be saved and reused and does not require an additional clone
2020-05-28 00:06:47 +02:00
Florian Dehau
96c6b4efcb refactor(tests): move test utilities to TestBackend
* Remove custom Debug implementation of Buffer
* Add `TestBackend::assert_buffer` to compare buffers in integration tests. When
the assertion fails, the output now show the list of differences in addition
of the views of the computed and expected buffers. This effectively replaces
the table of debug code for colors and modifiers as it is easier to read.
2020-05-21 21:59:39 +02:00
Stephan Dilly
7110fe0159 fix panic on narrow buffers (fixes #293) 2020-05-21 19:14:12 +02:00
Florian Dehau
5a590bca74 chore: enable clippy on all targets and all features
- Remove deny warnings in lib.rs. This allows easier iteration when developing
new features. The warnings will make the CI fails anyway on the clippy CI
stage.
- Run clippy on all targets (including tests and examples) and all features.
- Fail CI on clippy warnings.
2020-05-17 01:07:49 +02:00
Florian Dehau
a7761fe55d fix(buffer): ignore zero-width graphemes 2020-05-12 21:16:16 +02:00
Clement Tsang
b72ced4511
fix(widgets/chart): remove overflow when dataset if empty (#274)
* docs: Fix missing code block fence
* use slice::windows to deal with underflow issue
* add test for empty dataset and lines
2020-05-10 23:48:12 +02:00
Darrien Glasser
359b7feb8c
fix(widgets/canvas): Add bounds check when drawing line high/low (#283)
* Add bounds check when drawing line high/low
* Add test to ensure codepath doesn't break
2020-05-10 14:40:04 +02:00
Florian Dehau
5d99b4af00 docs: improve widgets documentation 2020-04-16 18:43:13 +02:00
Björn Steinbrink
8f9aa276e8 fix(widgets/list): fix line length calculation for selectable lists
The code that outputs the list elements uses the full inner width of its
block, without taking the width of the highlight symbol into
consideration. This allows the elements to overflow the box and draw
over the block's border. To fix that, we need to reduce the target width
for the list elements.
2020-04-16 15:31:37 +02:00
Florian Dehau
bc2a512101 feat: add missing Clone and Copy on types 2020-04-14 19:25:49 +02:00
Florian Dehau
4f728d363f fix(widgets/list): stop highlighting blank placeholders 2020-04-14 18:40:59 +02:00
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.
2020-04-14 02:17:22 +02:00
Florian Dehau
cee65ed283 feat: allow BarChart and Sparkline to use a more portable set of symbols
Add `BarChart::bar_set` and `Sparkline::bar_set` methods to customize
the set of symbols used to display the data. The new set should give
a better looking output on terminal that do not support a wide range
of unicode symbols.
2020-04-14 02:17:22 +02:00
Stephan Dilly
7676d3c7df add clear widget and popup example utilizing it 2020-04-12 15:16:24 +02:00
Stephan Dilly
fd48719040 fix some typos 2020-03-21 20:55:45 +01:00
Loïc Girault
d987225ac8 Add thick lines and line::Set struct
Add a new style of line and use a struct to avoid duplication of
matching
2020-03-21 13:35:37 +01:00
Florian Dehau
3f62ce9c19 chore: remove unecessary dependencies
* Remove log, stderrlog, structopt
* Add argh
2020-03-13 02:07:13 +01:00
Florian Dehau
278c153d31 style: remove clippy warnings 2020-03-13 01:12:14 +01:00
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
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
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
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
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
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
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
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
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
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
Joseph Knight
97357c0e08 typo in curses.rs 2019-08-11 14:03:58 +02:00
Joseph Knight
8649ce4c78 fixed typo in symbols.rs 2019-08-11 14:03:58 +02:00
Timon_Post
a0f6605f59 Implemented command api crossterm, for better perfomance. 2019-08-04 13:18:03 +02:00
Jeffas
db9b1dd689 Make margins be vertical or horizontal
This adds support for margins to be either vertical or horizontal, or
both.
2019-07-31 08:02:50 +02:00
Joe Ardent
86f681a007 Silence check warnings about [lack of] use of 'dyn' for boxed trait objects. 2019-07-16 06:16:14 +02:00
Florian Dehau
a3827aaeae Remove try call in termion backend 2019-07-16 05:46:53 +02:00
Jeremy Day
47c68e40a2 fix for canvas rendering edge cases causing overflow errors 2019-06-23 11:12:51 +02:00
Florian Dehau
2a7eec816a Add PartialEq to Text 2019-06-16 23:14:17 +02:00
Florian Dehau
8fbb764c9e Move Borders documentation 2019-06-16 23:02:52 +02:00
Florian Dehau
4756801fd9 Format 2019-06-16 22:21:55 +02:00
Russ
f0e0b515ad avoid divide by zero 2019-06-16 20:29:14 +02:00
defiori
25a0825ae4 fix: curses backend cursor positions 2019-06-16 20:22:24 +02:00
scauligi
b1ac297d71 fix crossterm terminal size and dark gray color 2019-06-16 20:17:31 +02:00
nytopop
8a9c76b003 Don't highlight Tabs separator behind selection 2019-06-03 20:11:03 +02:00
DarrienG
41cdd3e261 Provide clone and debug for Text type 2019-05-28 07:52:24 +02:00
Timon_Post
f6a0a91a23 fmt 2019-05-17 14:25:55 +02:00
timonpost@hotmail.nl
ffaaf5e39c review update 2019-05-17 14:25:55 +02:00
timonpost@hotmail.nl
567cf7b8e5 update 0.9.2 2019-05-17 14:25:55 +02:00
Florian Dehau
a74d335cb4 Fix clippy warnings 2019-04-14 11:48:35 +02:00
Florian Dehau
7a5ad3fbdb Fix sparkline panic when max is zero 2019-04-14 11:35:41 +02:00
Florian Dehau
4436110c44 Improve onboarding in documentation 2019-03-24 21:37:55 +01:00
Florian Dehau
f8b3526426 Add code example for Constraint::Ratio 2019-03-10 18:05:27 +01:00
Florian Dehau
43e38ac483 Fix Buffer::merge
Coordinates returned by Buffer::pos_of were interpreted as local coordinates
while they were global. This was resulting in panics due to out of bounds
accesses. Interpreting the coordinates as global and using correct offsets
when computing the new index within the buffer for each cell fix the issue.
2019-03-10 17:36:14 +01:00
David Flemström
21e79ca078 Rebase and include necessary curses changes 2019-03-10 15:56:56 +01:00
David Flemström
a25bbea555 Add workarounds for weird termion escape code handling 2019-03-10 15:56:56 +01:00
David Flemström
b7664a4108 Support several modifiers and indexed colors at once 2019-03-10 15:56:56 +01:00
David Flemström
d360cd3434 Support exact ratios for layout constraints 2019-02-28 07:15:24 +01:00
Florian Dehau
e037db076c fix(backend/curses): use chtype to achieve platform agnostic conversion of graphemes 2019-02-26 08:56:49 +01:00
Florian Dehau
3ef19f41e6 fix(backend/curses): avoid platform specific conversion of graphemes 2019-02-26 08:32:36 +01:00
Florian Dehau
da90ec15fa fix: add missing get_cursor and set_cursor on CursesBackend 2019-02-26 08:13:00 +01:00
Florian Dehau
7f5af46300 style: fmt 2019-02-26 08:12:43 +01:00
defiori
624e6ee047 fix: filter out wide unicode characters on windows 2019-02-26 07:49:59 +01:00
defiori
4a1f3cd61f feat: curses instance can be passed to backend 2019-02-26 07:49:59 +01:00
defiori
d75198a8ee feat: add pancurses backend 2019-02-26 07:49:59 +01:00
defiori
cadb41c9e3 fix: unified crossterm backend 2019-02-26 07:45:19 +01:00
defiori
b30cae0473 feat: crossterm backend can use alternate screen 2019-02-26 07:45:19 +01:00
scauligi
7290086fe9 forgot to flush 2019-02-26 07:38:35 +01:00
scauligi
bca920bea0 get/set cursor position 2019-02-26 07:38:35 +01:00
Jonathan
cd41ca571f Modified with_crossterm naming scheme 2019-02-10 22:47:56 +01:00
Jonathan
dc654e9f6c Added ability to create crossterm with previously created crossterm::Screen 2019-02-10 22:47:56 +01:00
Florian Dehau
b669cf9ce7 style: fix clippy warnings 2019-02-03 22:42:09 +01:00
Florian Dehau
97f764b45d feat: handle crossterm errors 2019-02-03 20:02:36 +01:00
Florian Dehau
52a40ec99a fix: remove undefined crossterm attributes in windows builds 2019-01-23 07:28:40 +01:00
Sven-Hendrik Haase
a78fa73b34 Add new shape: Rectangle 2019-01-15 15:47:05 +00:00
Jens Krause
1c0b0abf61 Use UnicodeWidthStr::width()
to get width of `divider`.

Also use `set_string` instead of `set_symbol`. The latter cuts content of a multi-char divider.
2019-01-13 17:21:03 +00:00
Jens Krause
f7c6620e25 Fix documented example to fix doc-tests on CI 2019-01-13 17:21:03 +00:00
Jens Krause
16372f7847 Don't show divider after last tab 2019-01-13 17:21:03 +00:00
Jens Krause
72c2eb7182 Add divider to Tabs
to change appearance of tab dividers.
2019-01-13 17:21:03 +00:00
Sven-Hendrik Haase
144bfb71cf Upgrade to 2018 edition 2019-01-13 14:35:51 +00:00
Karoline Pauls
3fd9e23851 Buffer: correct diffing of buffers with multi-width characters
Resolves #104
2019-01-13 13:46:39 +00:00
Karoline Pauls
10642d0e04 Paragraph: word wrapping 2018-12-22 15:38:51 +01:00
Karoline Pauls
1802cf8dbc Improve wrapping of double-width characters 2018-12-22 15:38:51 +01:00
Karoline Pauls
090975481b Update tests and docs to take size from the Frame 2018-12-07 21:32:00 +01:00
Karoline Pauls
228816f5f8 Frame: provide consistent size for rendering 2018-12-07 21:32:00 +01:00
Karoline Pauls
8522e028f1 Run cargo fmt with the new Rust stable toolchain (1.31.0) 2018-12-07 19:54:13 +01:00
Ash
a2776dfc86 Make sure we always emit a cursor goto for the first update.
Otherwise, if the first update is to (1, 0) then no goto occurs.
2018-12-07 19:52:22 +01:00
Karoline Pauls
cc95c8cfb0 Gauge: use f64 internally and allow to set any f64 between 0 and 1 2018-12-05 21:20:12 +01:00
Karoline Pauls
89dac9d2a6 buffer: add quotes to fmt::Debug for better testing experience 2018-12-05 21:20:12 +01:00
Karoline Pauls
8cdfc883b9 Feature: Autoresize
It basically never makes sense to render without syncing the size.

Without resizing, if shrinking, we get artefacts. If growing, we may get
panics (before this change the Rustbox sample (the only one which didn't
handle resizing on its own) panicked because the widget would get an
updated size, while the terminal would not).
2018-12-04 08:39:32 +01:00
Florian Dehau
b3689eceb7 feat: update outdated dependencies 2018-11-25 21:49:37 +01:00
Karoline Pauls
5cee2afc6d Limit Rect size to prevent u16 overflow 2018-11-25 19:59:12 +01:00
Florian Dehau
4c46ef69e9 Release v0.3.0 2018-11-04 20:25:07 +01:00
Florian Dehau
22e8fade7e feat: add experimental test backend 2018-11-04 20:16:10 +01:00
Florian Dehau
fdf3015ad0 feat(terminal): log error if failed to show cursor on drop 2018-10-14 17:00:13 +02:00
Karoline Pauls
03bfcde147 [widgets][paragraph]: Truncate long lines when wrap is false 2018-10-14 16:11:28 +02:00
Florian Dehau
7b4d35d224 feat: restore the cursor state on terminal drop 2018-09-24 08:03:52 +02:00
Florian Dehau
d8e5f57d53 style: fmt 2018-09-23 21:00:36 +02:00
Florian Dehau
aa85e597d9 fix(crossterm): fix goto coordinates 2018-09-23 21:00:18 +02:00
Florian Dehau
5d52fd2486 refactor: remove custom termion backends 2018-09-23 20:55:50 +02:00
Florian Dehau
4ae9850e13 fix: replace links to assets 2018-09-09 08:55:51 +02:00
Antoine Büsch
f795173886 Unify Item and Text 2018-09-08 08:41:57 +02:00
Antoine Büsch
e42ab1fed8 Move Text to widgets/mod.rs 2018-09-08 08:41:57 +02:00
Antoine Büsch
0544c023f5 Rename Text::{Data -> Raw, StyledData -> Styled} 2018-09-08 08:41:57 +02:00
Antoine Büsch
ff47f9480b Introduce builder methods for Text to make it more ergonomic 2018-09-08 08:41:57 +02:00
Antoine Büsch
70561b7c54 Fix examples and doctests 2018-09-08 08:41:57 +02:00
Antoine Büsch
559c9c75f3 Make Text accept both borrowed and owned strings 2018-09-08 08:41:57 +02:00
Florian Dehau
6c69160d6b feat: remove unecessary borrows of Style 2018-09-07 22:24:52 +02:00
Florian Dehau
cf169d1582 style: run rustfmt and clippy 2018-09-04 22:23:44 +02:00
Florian Dehau
bcd1e30376 refactor: update List select behavior
* allow a selectable list to have no selected item
* show highlight_symbol only when something is selected
2018-09-04 22:23:44 +02:00
Florian Dehau
40bad7a718 feat: add initial support for crossterm 2018-09-04 22:23:44 +02:00
Florian Dehau
3d63f9607f doc: update main documentation 2018-09-04 22:23:44 +02:00
Florian Dehau
13e194cd26 refactor: update widgets
* all widgets use the consumable builder pattern
* `draw` on terminal expect a closure that take a frame as only arg
2018-09-04 22:23:44 +02:00
Florian Dehau
d6016788ef refactor: clippy + rustfmt 2018-09-04 22:23:44 +02:00
Florian Dehau
ad602a54bf refactor(widgets): replace text rendering in Paragraph
* remove custom markup language
* add Text container for both raw and styled strings
2018-09-04 22:23:44 +02:00
Florian Dehau
7181970a32 feat: split layout from rendering
* remove layout logic from Terminal
* replace Group with Layout
* add Frame intermediate object
2018-09-04 22:23:44 +02:00
Jeremy Day
cfc90ab7f6 fix(widgets): Prevent chart legend from rendering when no dataset has a name 2018-08-24 06:27:16 +02:00
Florian Dehau
9a9f49f467 fix(backend): Add missing color pattern 2018-06-09 11:49:44 +02:00
Florian Dehau
df7493fd33 style: Run rustfmt 2018-06-09 11:26:59 +02:00
Florian Dehau
5de571fb03 feat(widgets): Add start_corner option to List 2018-06-09 11:26:59 +02:00
Florian Dehau
62df7badf3 feat(layout): Add Corner enum 2018-06-09 11:26:59 +02:00
Robin Nehls
3f8a9079ee [widgets] implement text alignment for paragraph widget 2018-05-25 21:09:27 +02:00