Commit graph

794 commits

Author SHA1 Message Date
Josh McKinney
2889c7d084
fix(lint): suspicious_double_ref_op is new in 1.71 (#311)
Fixed tests and completed coverage for `Masked` type.
2023-07-14 02:18:07 +00:00
Florian
57678a5fe8
feat(examples): user_input example cursor movement (#302)
The user_input example now responds to left/right and allows the
character at the cursor position to be deleted / inserted.

Co-authored-by: Leon Sautour <leon1.sautour@epitech.eu>
2023-07-13 10:41:10 +00:00
Hichem
ae8ed8867d
feat(barchart): enable barchart groups (#288)
* feat(barchart): allow to add a group of bars

Example: to show the revenue of different companies:
┌────────────────────────┐
│             ████       │
│             ████       │
│      ████   ████       │
│ ▄▄▄▄ ████   ████ ████  │
│ ████ ████   ████ ████  │
│ ████ ████   ████ ████  │
│ █50█ █60█   █90█ █55█  │
│    Mars       April    │
└────────────────────────┘
new structs are introduced: Group and Bar.
the data function is modified to accept "impl Into<Group<'a>>".

a new function "group_gap" is introduced to set the gap between each group

unit test changed to allow the label to be in the center

Signed-off-by: Ben Fekih, Hichem <hichem.f@live.de>

* feat(barchart)!: center labels by default

The bar labels are currently printed string from the left side of
bar. This commit centers the labels under the bar.

Signed-off-by: Ben Fekih, Hichem <hichem.f@live.de>

---------

Signed-off-by: Ben Fekih, Hichem <hichem.f@live.de>
2023-07-13 10:27:08 +00:00
Josh McKinney
e66d5cdee0
docs(color): parse more color formats and add docs (#306) 2023-07-12 13:49:28 +00:00
Josh McKinney
804115ac6f
feat(prelude): add a prelude (#304)
This allows users of the library to easily use ratatui without a huge amount of imports
2023-07-10 22:59:01 +00:00
Josh McKinney
a1813af297
test(barchart): add unit tests (#301) 2023-07-09 01:17:34 +00:00
Orhun Parmaksız
085fde7d4a
chore(github): add EditorConfig config (#300) 2023-07-08 20:21:24 +00:00
Orhun Parmaksız
860a40c13a
style(readme): update the style of badges in README.md (#299) 2023-07-08 20:19:56 +00:00
Josh McKinney
0833c9018b
docs: improve CONTRIBUTING.md (#277) 2023-07-08 19:02:22 +00:00
a-kenji
f7c4b44962
feat(style): allow Modifiers add/remove in const (#287)
Allows Modifiers to be added or removed from `Style` in a const context.
This can be used in the following way:

```
const DEFAULT_MODIFIER: Modifier = Modifier::BOLD.union(Modifier::ITALIC);
const DEFAULT_STYLE: Style = Style::new()
.fg(Color::Red).bg(Color::Black).add_modifier(DEFAULT_MODIFIER);
```
2023-07-08 10:12:48 +00:00
Josh McKinney
56e44a0efa
chore(license): add Ratatui developers to license (#297) 2023-07-06 12:28:48 +00:00
Josh McKinney
ad288f5168
chore(features): enable building with all-features (#286)
Before this change, it wasn't possible to build all features and all
targets at the same time, which prevents rust-analyzer from working
for the whole project.

Adds a bacon.toml file to the project, which is used by bacon
https://dystroy.org/bacon/

Configures docs.rs to show the feature flags that are necessary to
make modules / types / functions available.
2023-07-04 03:58:25 +00:00
Josh McKinney
c5d387cb53
style: fix formatting (#292)
There are a couple of small formatting changes in the current nightly
2023-07-02 18:47:02 +00:00
Samy Rahmani
2f4413be6e
feat: stylization shorthands (#283) 2023-07-01 09:14:16 +00:00
Josh McKinney
83d3ec73e7
fix(clippy): ununsed_mut lint for layout (#285)
This lint is slightly more agressive in +nightly than it is in stable.
2023-06-30 22:01:58 +00:00
Josh McKinney
cf8eda04a1
test(paragraph): simplify paragraph benchmarks (#282)
Reduce benchmarks from 60 calls to 18. Now 3 different line counts
(64, 2048, 65535) * 6 different tests (new, render, scroll half / full,
wrap, wrap and scroll)
2023-06-29 22:12:02 +00:00
SLASHLogin
6bdb97c55c
ci(makefile): split CI jobs (#278)
- Split CI into build, clippy and test.
- Run format on nightly only due to the settings being unstable
2023-06-26 07:31:30 +00:00
a-kenji
7a6c3d9db1
feat(misc): make builder fn const (#275) (#275)
This allows the following types to be used in a constant context:
- `Layout`
- `Rect`
- `Style`
- `BorderType`
- `Padding`
- `Block`

Also adds several missing `new()` functions to the above types.

Blocks can now be used in the following way:
```
const DEFAULT_BLOCK: Block = Block::new()
    .title_style(Style::new())
    .title_alignment(Alignment::Left)
    .title_position(Position::Top)
    .borders(Borders::ALL)
    .border_style(Style::new())
    .style(Style::reset())
    .padding(Padding::uniform(1));

```

Layouts can now be used in the following way:
``
const DEFAULT_LAYOUT: Layout = Layout::new()
    .direction(Direction::Horizontal)
    .margin(1)
    .expand_to_fill(false);
```

Rects can now be used in the following way:
```
const RECT: Rect = Rect {
    x: 0,
    y: 0,
    width: 10,
    height: 10,
};
```
2023-06-26 00:09:51 +00:00
a-kenji
bfcc5504bb
style(widget): inline format arguments (#279) 2023-06-25 13:19:21 +00:00
SLASHLogin
669a4d5652
build: add git pre-push hooks using cargo-husky (#274)
Fixes https://github.com/tui-rs-revival/ratatui/issues/214
- add cargo-husky to dev-deps
- create hook
- update `CONTRIBUTING.md`
- ensure that the hook is not installed in CI
2023-06-24 06:03:31 +00:00
SLASHLogin
b808305507
docs: fix scrollbar ascii illustrations and calendar doc paths (#272)
* docs(src\widgets\scrollbar.rs): wrap scrollbar's visualisation in text block

'cargo doc' and 'rust-analyzer' removes many whitespaces thus making those parts render improperly

* docs(src/widgets/calendar.rs): fix `no item named ...` for calendar.rs

* style(src/widgets/block.rs): format `block.rs`
2023-06-21 11:57:50 +00:00
Samy Rahmani
a04b190251
feat(block): support for having more than one title (#232) 2023-06-19 08:24:36 +00:00
Leon Sautour
e869869462
ci: add feat-wrapping on push and on pull request ci triggers (#267) 2023-06-19 08:18:27 +00:00
a-kenji
20c0051026
docs(lib): add tui-term a pseudoterminal library (#268) 2023-06-19 08:15:52 +00:00
Orhun Parmaksız
284b0b8de0
chore(github): simplify the CODEOWNERS file (#271) 2023-06-19 00:41:18 +00:00
Dheepak Krishnamurthy
130bdf8337
feat: add scrollbar widget (#228)
Represents a scrollbar widget that renders a track, thumb and arrows
either horizontally or vertically. State is kept in ScrollbarState, and
passed as a parameter to the render function.
2023-06-17 19:25:43 +00:00
Orhun Parmaksız
8b7b7881f5
chore(github): add pull request template (#269) 2023-06-17 17:36:34 +00:00
Ende
28a8435a52
fix(layout): cap Contstraint::apply to 100% length (#264)
This function is only currently used in by the chart widget for
constraining the width and height of the legend.
2023-06-17 10:44:13 +00:00
Josh McKinney
dca9871744
fix: revert removal of WTFPL from deny.toml (#266)
This is actually used for terminfo (transitively from termwiz
2023-06-17 08:54:25 +00:00
Josh McKinney
6c2fbbf275
test: add benchmarks for paragraph (#262)
To run the benchmarks:

    cargo bench

And then open the generated `target/criterion/report/index.html` in a
browser.

- add the BSD 2 clause and ISC licenses to the `cargo deny` allowed
licenses list (as a transitive dependency of the `fakeit` crate).
- remove the WTFPL license from the `cargo deny` allowed licenses list
as it is unused and causes a warning when running the check.
2023-06-16 13:09:41 +00:00
Chris Morris
43bac80e4d
fix(examples): Correct progress label in gague example (#263) 2023-06-16 09:17:04 +00:00
Orhun Parmaksız
0bf6af17e7
refactor(ci): simplify cargo-make installation (#240)
* refactor(ci): simplify cargo-make installation

* chore(ci): use the latest version of cargo-make

* refactor(ci): remove unused triple values

* chore(ci): list all steps before ci

* fix(ci): checkout the repository

* refactor(ci): remove unnecessary os variables

* refactor(ci): use dtolnay/rust-toolchain action
2023-06-12 23:25:18 +00:00
Josh McKinney
f7af8a3863
style: reformat imports (#219)
Order imports by std, external, crate and group them by crate
2023-06-12 05:07:15 +00:00
Orhun Parmaksız
492af7a92d
chore(ci): bump cargo-make version (#239) 2023-06-11 21:01:21 +00:00
Orhun Parmaksız
de4f2b9990
chore(demo): update demo gif (#234) 2023-06-11 20:33:25 +00:00
Orhun Parmaksız
4a2ff204ec
chore(ci): enable merge queue for builds (#235)
* chore(ci): enable merge queue for builds

https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue

* style(ci): format the ci workflow
2023-06-11 20:28:17 +00:00
Orhun Parmaksız
26dbb29b3d
style(manifest): apply formatting to Cargo.toml (#237) 2023-06-11 20:27:35 +00:00
Orhun Parmaksız
231aae2920
style(config): apply formatting to config files (#238) 2023-06-11 20:26:45 +00:00
Orhun Parmaksız
4cc7380a88
chore(github): fix the syntax in CODEOWNERS file (#236) 2023-06-11 20:25:14 +00:00
Josh McKinney
593fd29d00
chore(demo): update demo gif with a fixed unicode gauge (#227)
* fix(gauge): render gauge with unicode correctly

Gauge now correctly renders a block rather than a space when in unicode mode.

* docs: update demo.gif

- remove existing gif
- upload using VHS (https://github.com/charmbracelet/vhs)
- add instructions to RELEASE.md
- link new gif in README
2023-06-11 16:23:23 +02:00
Philipp Mildenberger
f84d97b17b feat(terminal): expose 'swap_buffers' method 2023-06-10 22:39:55 -07:00
Josh McKinney
ef4d743af3
fix(typos): configure typos linter (#233)
- Adds a new typos.toml
- Prevents ratatui from being marked as a typo of ratatouille
- Changes paragraph tests so that the truncated word is a valid word
2023-06-10 16:31:36 -07:00
Josh McKinney
9ecc4a15df
docs: README tweaks (#225)
- Add contributors graph
- Add markdownlint config file
- Reformat README line width to 100
- Add a link to the CHANGELOG
- Remove APPS.md
- Change apps link to the Wiki instead of APPS.md
2023-06-08 11:00:18 +02:00
snpefk
e165025c94
docs(readme): remove duplicated mention of tui-rs-tree-widgets (#223) 2023-06-05 23:00:21 +02:00
Orhun Parmaksız
d711f2aef3
chore(ci): integrate cargo-deny for linting dependencies (#221) 2023-06-04 17:32:20 +02:00
Nydragon
e724bec987
chore(commitizen): add commitizen config (#222)
* style(commitizen): add commitizen

add customized commitizen config to match repo needs

implement request mentioned in [#214](https://github.com/tui-rs-revival/ratatui/issues/214) by @joshka

* docs(CONTRIBUTING.md): add a section for the commitizen installation

BREAKING_CHANGE:

* style(commitizen): update breaking change default to false
2023-06-04 17:31:49 +02:00
Josh McKinney
40b3543c3f
style(comments): set comment length to wrap at 100 chars (#218)
This is an opinionated default that helps avoid horizontal scrolling.
100 is the most common width on github rust projects and works well for
displaying code on a 16in macbook pro.
2023-06-04 12:34:05 +02:00
Josh McKinney
e95b5127ca
docs(lib): fixup tui refs in widgets/mod.rs (#216) 2023-06-04 12:33:09 +02:00
Josh McKinney
5243aa0628
docs(lib): add backend docs (#213) 2023-06-02 19:13:56 +02:00
Yuri Astrakhan
509d18501c
chore: lint and doc cleanup (#191)
* chore: Lint and doc cleanup

A few more minor cleanups, mostly in documentation

* Remove unused comment
2023-06-02 16:03:34 +02:00