v0.28.2-alpha.6 - 2024-10-12
Features
-
2805ddd (logo) Add a Ratatui logo widget by @joshka in #1307
This is a simple logo widget that can be used to render the Ratatui logo
in the terminal. It is used in theexamples/ratatui-logo.rs
example,
and may be used in your applications' help or about screens.use ratatui::{Frame, widgets::RatatuiLogo}; fn draw(frame: &mut Frame) { frame.render_widget(RatatuiLogo::tiny(), frame.area()); }
-
23c0d52 (text) Improve concise debug view for Span,Line,Text,Style by @joshka in #1410
Improves #1383
The following now round trips when formatted for debug.
This will make it easier to use insta when testing text related views of
widgets.Text::from_iter([ Line::from("Hello, world!"), Line::from("How are you?").bold().left_aligned(), Line::from_iter([ Span::from("I'm "), Span::from("doing ").italic(), Span::from("great!").bold(), ]), ]).on_blue().italic().centered()
Bug Fixes
-
0f48239 (terminal) Resize() now resizes fixed viewports by @Patryk27 in #1353
Terminal::resize()
on a fixed viewport used to do nothing due to
an accidentally shadowed variable. This now works as intended. -
b9653ba (uncategorized) Prevent calender render panic when terminal height is small by @adrodgers in #1380
Fixes:#1379
-
da821b4 (uncategorized) Clippy lints from rust 1.81.0 by @fujiapple852 in #1356
-
68886d1 (uncategorized) Add
unstable-backend-writer
feature by @Patryk27 in #1352#991 created a new unstable
feature, but forgot to add it to Cargo.toml, making it impossible to use
on newer versions of rustc - this commit fixes it.
Refactor
-
edcdc8a (layout) Rename element to segment in layout by @kdheepak in #1397
This PR renames
element
tosegment
in a couple of functions in the
layout calculations for clarity.element
can refer tosegment
s or
spacer
s and functions that take onlysegment
s should usesegment
as the variable names. -
1153a9e (uncategorized) Consistent result expected in layout tests by @farmeroy in #1406
Fixes #1399
I've looked through all theassert_eq
and made sure that they follow
theexpected, result
pattern. I wasn't sure if it was desired to
actually pass result and expected as variables to the assert_eq
statements, so I've left everything that seems to have followed the
pattern as is. -
20c88aa (uncategorized) Avoid unneeded allocations by @mo8it in #1345
Documentation
-
b13e2f9 (backend) Added link to stdio FAQ by @Valentin271 in #1349
-
b88717b (constraint) Add note about percentages by @joshka in #1368
-
870bc6a (uncategorized) Use
Frame::area()
instead ofsize()
in examples by @hosseinnedaee in #1361Frame::size()
is deprecated
Styling
Miscellaneous Tasks
-
67c0ea2 (block) Deprecate block::Title by @joshka in #1372
ratatui::widgets::block::Title
is deprecated in favor of usingLine
to represent titles.
This removes an unnecessary layer of wrapping (string -> Span -> Line ->
Title).This struct will be removed in a future release of Ratatui (likely
0.31).
For more information see:To update your code:
Block::new().title(Title::from("foo")); // becomes any of Block::new().title("foo"); Block::new().title(Line::from("foo")); Block::new().title(Title::from("foo").position(Position::TOP)); // becomes any of Block::new().title_top("foo"); Block::new().title_top(Line::from("foo")); Block::new().title(Title::from("foo").position(Position::BOTTOM)); // becomes any of Block::new().title_bottom("foo"); Block::new().title_bottom(Line::from("foo"));
-
c777beb (ci) Bump git-cliff-action to v4 by @orhun in #1350
See:https://github.com/orhun/git-cliff-action/releases/tag/v4.0.0
-
bc10af5 (style) Make Debug output for Text/Line/Span/Style more concise by @joshka in #1383
Given:```rust
Text::from_iter([
Line::from("without line fields"),
Line::from("with line fields").bold().centered(),
Line::from_iter([
Span::from("without span fields"),
Span::from("with span fields")
.green()
.on_black()
.italic()
.not_dim(),
]),
])Debug:``` Text [Line [Span("without line fields")], Line { style: Style::new().add_modifier(Modifier::BOLD), alignment: Some(Center), spans: [Span("with line fields")] }, Line [Span("without span fields"), Span { style: Style::new().green().on_black().add_modifier(Modifier::ITALIC).remove_modifier(Modifier::DIM), content: "with span fields" }]]
Fixes:#1382
-
c32baa7 (uncategorized) Add benchmark for
Table
by @airblast-dev in #1408 -
5ad623c (uncategorized) Remove usage of prelude by @joshka in #1390
This helps make the doc examples more explicit about what is being used.
It will also makes it a bit easier to do future refactoring of Ratatui,
into several crates, as the ambiguity of where types are coming from
will be reduced.Additionally, several doc examples have been simplified to use Stylize,
and necessary imports are no longer hidden.This doesn't remove the prelude. Only the internal usages.
-
f4880b4 (uncategorized) Lock unicode-width version to 0.1.13 by @joshka in #1384
0.1.14 contains breaking changes which we'll need to investigate.
This commit puts a lock on the current version for now.
Continuous Integration
New Contributors
- @farmeroy made their first contribution in #1406
- @adrodgers made their first contribution in #1380
- @Veetaha made their first contribution in #1362
- @hosseinnedaee made their first contribution in #1361
- @Patryk27 made their first contribution in #1352
Full Changelog: v0.28.1...v0.28.2-alpha.6