Releases: ratatui/ratatui
v0.28.2-alpha.3
v0.28.2-alpha.3 - 2024-09-21
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
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
Continuous Integration
New Contributors
- @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.3
v0.28.2-alpha.2
v0.28.2-alpha.2 - 2024-09-14
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. -
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
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
- 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
Continuous Integration
New Contributors
- @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.2
v0.28.2-alpha.1
v0.28.2-alpha.1 - 2024-09-07
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. -
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
Documentation
- b13e2f9 (backend) Added link to stdio FAQ by @Valentin271 in #1349
Styling
Miscellaneous Tasks
- 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
New Contributors
Full Changelog: v0.28.1...v0.28.2-alpha.1
v0.28.2-alpha.0
v0.28.1
v0.28.1 - 2024-08-25
Features
-
ed51c4b (terminal) Add ratatui::init() and restore() methods by @joshka in #1289
These are simple opinionated methods for creating a terminal that is
useful to use in most apps. The new init method creates a crossterm
backend writing to stdout, enables raw mode, enters the alternate
screen, and sets a panic handler that restores the terminal on panic.A minimal hello world now looks a bit like:
use ratatui::{ crossterm::event::{self, Event}, text::Text, Frame, }; fn main() { let mut terminal = ratatui::init(); loop { terminal .draw(|frame: &mut Frame| frame.render_widget(Text::raw("Hello World!"), frame.area())) .expect("Failed to draw"); if matches!(event::read().expect("failed to read event"), Event::Key(_)) { break; } } ratatui::restore(); }
A type alias
DefaultTerminal
is added to represent this terminal
type and to simplify any cases where applications need to pass this
terminal around. It is equivalent to:
Terminal<CrosstermBackend<Stdout>>
We also added
ratatui::try_init()
andtry_restore()
, for situations
where you might want to handle initialization errors yourself instead
of letting the panic handler fire and cleanup. Simple Apps should
prefer theinit
andrestore
functions over these functions.Corresponding functions to allow passing a
TerminalOptions
with
aViewport
(e.g. inline, fixed) are also available
(init_with_options
,
andtry_init_with_options
).The existing code to create a backend and terminal will remain and
is not deprecated by this approach. This just provides a simple one
line initialization using the common options.
Bug Fixes
-
aed60b9 (terminal) Terminal::insert_before would crash when called while the viewport filled the screen by @nfachan in #1329
Reimplement Terminal::insert_before. The previous implementation would
insert the new lines in chunks into the area between the top of the
screen and the top of the (new) viewport. If the viewport filled the
screen, there would be no area in which to insert lines, and the
function would crash.The new implementation uses as much of the screen as it needs to, all
the way up to using the whole screen.This commit:
- adds a scrollback buffer to the
TestBackend
so that tests can
inspect and assert the state of the scrollback buffer in addition to the
screen - adds functions to
TestBackend
to assert the state of the scrollback - adds and updates
TestBackend
tests to test the behavior of the
scrollback and the new asserting functions - reimplements
Terminal::insert_before
, including adding two new
helper functionsTerminal::draw_lines
andTerminal::scroll_up
. - updates the documentation for
Terminal::insert_before
to clarify
some of the edge cases - updates terminal tests to assert the state of the scrollback buffer
- adds a new test for the condition that causes the bug
- adds a conversion constructor
Cell::from(char)
Fixes:#999
- adds a scrollback buffer to the
-
fdd5d8c (text) Remove trailing newline from single-line Display trait impl by @LucasPickering in #1320
-
2fb0b8a (uncategorized) Fix u16 overflow in Terminal::insert_before. by @nfachan in #1323
If the amount of characters in the screen above the viewport was greater
than u16::MAX, a multiplication would overflow. The multiply was used to
compute the maximum chunk size. The fix is to just do the multiplication
as a usize and also do the subsequent division as a usize.There is currently another outstanding issue that limits the amount of
characters that can be inserted when calling Terminal::insert_before to
u16::MAX. However, this bug can still occur even if the viewport and the
amount of characters being inserted are both less than u16::MAX, since
it's dependant on how large the screen is above the viewport.Fixes #1322
Documentation
-
3631b34 (examples) Add widget implementation example by @joshka in #1147
This new example documents the various ways to implement widgets in
Ratatui. It demonstrates how to implement theWidget
trait on a type,
a reference, and a mutable reference. It also shows how to use the
WidgetRef
trait to render boxed widgets. -
d5477b5 (examples) Use ratatui::crossterm in examples by @joshka in #1315
-
730dfd4 (examples) Show line gauge in demo example by @montmorill in #1309
-
9ed85fd (table) Fix incorrect backticks in
TableState
docs by @airblast-dev in #1342 -
6d1bd99 (uncategorized) Minor grammar fixes by @matta in #1330
-
097ee86 (uncategorized) Remove superfluous doc(inline) by @EdJoPaTo in #1310
It's no longer needed since #1260
-
3fdb5e8 (uncategorized) Fix typo in terminal.rs by @mrjackwills in #1313
Testing
-
0d5f3c0 (uncategorized) Avoid unneeded allocations in assertions by @mo8it in #1335
A vector can be compared to an array.
Miscellaneous Tasks
-
65da535 (ci) Update release strategy by @orhun in #1337
closes #1232
Now we can trigger point releases by pushing a tag (follow the
instructions inRELEASE.md
). This will create a release with generated
changelog.There is still a lack of automation (e.g. updating
CHANGELOG.md
), but
this PR is a good start towards improving that. -
57d8b74 (ci) Use cargo-docs-rs to lint docs by @joshka in #1318
-
23516bc (uncategorized) Rename ratatui-org to ratatui by @joshka in #1334
All urls updated to point at https://github.com/ratatui
To update your repository remotes, you can run the following commands:
git remote set-url origin https://github.com/ratatui/ratatui
Build
-
0256269 (uncategorized) Simplify Windows build by @joshka in #1317
Termion is not supported on Windows, so we need to avoid building it.
Adds a conditional dependency to the Cargo.toml file to only include
termion when the target is not Windows. This allows contributors to
build using the--all-features
flag on Windows rather than needing
to specify the features individually.
New Contributors
- @nfachan made their first contribution in #1329
- @LucasPickering made their first contribution in #1320
- @montmorill made their first contribution in #1309
Full Changelog: v0.28.0...v0.28.1
v0.28.1-alpha.2
v0.28.1-alpha.2 - 2024-08-24
Features
-
ed51c4b (terminal) Add ratatui::init() and restore() methods by @joshka in #1289
These are simple opinionated methods for creating a terminal that is
useful to use in most apps. The new init method creates a crossterm
backend writing to stdout, enables raw mode, enters the alternate
screen, and sets a panic handler that restores the terminal on panic.A minimal hello world now looks a bit like:
use ratatui::{ crossterm::event::{self, Event}, text::Text, Frame, }; fn main() { let mut terminal = ratatui::init(); loop { terminal .draw(|frame: &mut Frame| frame.render_widget(Text::raw("Hello World!"), frame.area())) .expect("Failed to draw"); if matches!(event::read().expect("failed to read event"), Event::Key(_)) { break; } } ratatui::restore(); }
A type alias
DefaultTerminal
is added to represent this terminal
type and to simplify any cases where applications need to pass this
terminal around. It is equivalent to:
Terminal<CrosstermBackend<Stdout>>
We also added
ratatui::try_init()
andtry_restore()
, for situations
where you might want to handle initialization errors yourself instead
of letting the panic handler fire and cleanup. Simple Apps should
prefer theinit
andrestore
functions over these functions.Corresponding functions to allow passing a
TerminalOptions
with
aViewport
(e.g. inline, fixed) are also available
(init_with_options
,
andtry_init_with_options
).The existing code to create a backend and terminal will remain and
is not deprecated by this approach. This just provides a simple one
line initialization using the common options.
Bug Fixes
-
aed60b9 (terminal) Terminal::insert_before would crash when called while the viewport filled the screen by @nfachan in #1329
Reimplement Terminal::insert_before. The previous implementation would
insert the new lines in chunks into the area between the top of the
screen and the top of the (new) viewport. If the viewport filled the
screen, there would be no area in which to insert lines, and the
function would crash.The new implementation uses as much of the screen as it needs to, all
the way up to using the whole screen.This commit:
- adds a scrollback buffer to the
TestBackend
so that tests can
inspect and assert the state of the scrollback buffer in addition to the
screen - adds functions to
TestBackend
to assert the state of the scrollback - adds and updates
TestBackend
tests to test the behavior of the
scrollback and the new asserting functions - reimplements
Terminal::insert_before
, including adding two new
helper functionsTerminal::draw_lines
andTerminal::scroll_up
. - updates the documentation for
Terminal::insert_before
to clarify
some of the edge cases - updates terminal tests to assert the state of the scrollback buffer
- adds a new test for the condition that causes the bug
- adds a conversion constructor
Cell::from(char)
Fixes:#999
- adds a scrollback buffer to the
-
fdd5d8c (text) Remove trailing newline from single-line Display trait impl by @LucasPickering in #1320
-
2fb0b8a (uncategorized) Fix u16 overflow in Terminal::insert_before. by @nfachan in #1323
If the amount of characters in the screen above the viewport was greater
than u16::MAX, a multiplication would overflow. The multiply was used to
compute the maximum chunk size. The fix is to just do the multiplication
as a usize and also do the subsequent division as a usize.There is currently another outstanding issue that limits the amount of
characters that can be inserted when calling Terminal::insert_before to
u16::MAX. However, this bug can still occur even if the viewport and the
amount of characters being inserted are both less than u16::MAX, since
it's dependant on how large the screen is above the viewport.Fixes #1322
Documentation
-
3631b34 (examples) Add widget implementation example by @joshka in #1147
This new example documents the various ways to implement widgets in
Ratatui. It demonstrates how to implement theWidget
trait on a type,
a reference, and a mutable reference. It also shows how to use the
WidgetRef
trait to render boxed widgets. -
d5477b5 (examples) Use ratatui::crossterm in examples by @joshka in #1315
-
730dfd4 (examples) Show line gauge in demo example by @montmorill in #1309
-
6d1bd99 (uncategorized) Minor grammar fixes by @matta in #1330
-
097ee86 (uncategorized) Remove superfluous doc(inline) by @EdJoPaTo in #1310
It's no longer needed since #1260
-
3fdb5e8 (uncategorized) Fix typo in terminal.rs by @mrjackwills in #1313
Testing
-
0d5f3c0 (uncategorized) Avoid unneeded allocations in assertions by @mo8it in #1335
A vector can be compared to an array.
Miscellaneous Tasks
-
57d8b74 (ci) Use cargo-docs-rs to lint docs by @joshka in #1318
-
23516bc (uncategorized) Rename ratatui-org to ratatui by @joshka in #1334
All urls updated to point at https://github.com/ratatui
To update your repository remotes, you can run the following commands:
git remote set-url origin https://github.com/ratatui/ratatui
Build
-
0256269 (uncategorized) Simplify Windows build by @joshka in #1317
Termion is not supported on Windows, so we need to avoid building it.
Adds a conditional dependency to the Cargo.toml file to only include
termion when the target is not Windows. This allows contributors to
build using the--all-features
flag on Windows rather than needing
to specify the features individually.
New Contributors
- @nfachan made their first contribution in #1329
- @LucasPickering made their first contribution in #1320
- @montmorill made their first contribution in #1309
Full Changelog: v0.28.0...v0.28.1-alpha.2
v0.28.1-alpha.1
v0.28.1-alpha.1 - 2024-08-17
Bug Fixes
-
fdd5d8c (text) Remove trailing newline from single-line Display trait impl by @LucasPickering in #1320
-
2fb0b8a (uncategorized) Fix u16 overflow in Terminal::insert_before. by @nfachan in #1323
If the amount of characters in the screen above the viewport was greater
than u16::MAX, a multiplication would overflow. The multiply was used to
compute the maximum chunk size. The fix is to just do the multiplication
as a usize and also do the subsequent division as a usize.There is currently another outstanding issue that limits the amount of
characters that can be inserted when calling Terminal::insert_before to
u16::MAX. However, this bug can still occur even if the viewport and the
amount of characters being inserted are both less than u16::MAX, since
it's dependant on how large the screen is above the viewport.Fixes #1322
Documentation
-
d5477b5 (examples) Use ratatui::crossterm in examples by @joshka in #1315
-
730dfd4 (examples) Show line gauge in demo example by @montmorill in #1309
-
097ee86 (uncategorized) Remove superfluous doc(inline) by @EdJoPaTo in #1310
It's no longer needed since #1260
-
3fdb5e8 (uncategorized) Fix typo in terminal.rs by @mrjackwills in #1313
Miscellaneous Tasks
Build
-
0256269 (uncategorized) Simplify Windows build by @joshka in #1317
Termion is not supported on Windows, so we need to avoid building it.
Adds a conditional dependency to the Cargo.toml file to only include
termion when the target is not Windows. This allows contributors to
build using the--all-features
flag on Windows rather than needing
to specify the features individually.
New Contributors
- @nfachan made their first contribution in #1323
- @LucasPickering made their first contribution in #1320
- @montmorill made their first contribution in #1309
Full Changelog: v0.28.0...v0.28.1-alpha.1
v0.28.1-alpha.0
v0.28.1-alpha.0 - 2024-08-10
Documentation
-
730dfd4 (examples) Show line gauge in demo example by @montmorill in #1309
-
097ee86 (uncategorized) Remove superfluous doc(inline) by @EdJoPaTo in #1310
It's no longer needed since #1260
-
3fdb5e8 (uncategorized) Fix typo in terminal.rs by @mrjackwills in #1313
New Contributors
- @montmorill made their first contribution in #1309
Full Changelog: v0.28.0...v0.28.1-alpha.0
v0.28.0
0.28.0 - 2024-08-07
"If you are what you eat, then I only want to eat the good stuff." – Remy
We are excited to announce the new version of ratatui
- a Rust library that's all about cooking up TUIs 🐭
In this version, we have upgraded to Crossterm 0.28.0, introducing enhanced functionality and performance improvements.
New features include GraphType::Bar, lines in bar charts, and enhanced scroll/navigation methods.
We have also refined the terminal module and added brand new methods for cursor positions and text operations.
✨ Release highlights: https://ratatui.rs/highlights/v028/
Features
-
8d4a102 (barchart) Allow axes to accept Lines by @joshka in #1273 [breaking]
Fixes:#1272
-
a23ecd9 (buffer) Add Buffer::cell, cell_mut and index implementations by @joshka in #1084
Code which previously called
buf.get(x, y)
orbuf.get_mut(x, y)
should now use index operators, or be transitioned tobuff.cell()
or
buf.cell_mut()
for safe access that avoids panics by returning
Option<&Cell>
andOption<&mut Cell>
.The new methods accept
Into<Position>
instead ofx
andy
coordinates, which makes them more ergonomic to use.let mut buffer = Buffer::empty(Rect::new(0, 0, 10, 10)); let cell = buf[(0, 0)]; let cell = buf[Position::new(0, 0)]; let symbol = buf.cell((0, 0)).map(|cell| cell.symbol()); let symbol = buf.cell(Position::new(0, 0)).map(|cell| cell.symbol()); buf[(0, 0)].set_symbol("🐀"); buf[Position::new(0, 0)].set_symbol("🐀"); buf.cell_mut((0, 0)).map(|cell| cell.set_symbol("🐀")); buf.cell_mut(Position::new(0, 0)).map(|cell| cell.set_symbol("🐀"));
The existing
get()
andget_mut()
methods are marked as deprecated.
These are fairly widely used and we will leave these methods around on
the buffer for a longer time than our normal deprecation approach (2
major release)Addresses part of: #1011
-
afe1534 (chart) Accept
IntoIterator
for axis labels by @EdJoPaTo in #1283 [breaking]BREAKING CHANGES: #1273 is already breaking and this only advances the
already breaking part -
5b51018 (chart) Add GraphType::Bar by @joshka in #1205
-
f97e07c (frame) Replace Frame::size() with Frame::area() by @EdJoPaTo in #1293
Area is the more correct term for the result of this method.
The Frame::size() method is marked as deprecated and will be
removed around Ratatui version 0.30 or later.Fixes:#1254 (comment)
-
5b89bd0 (layout) Add Size::ZERO and Position::ORIGIN constants by @EdJoPaTo in #1253
-
b2aa843 (layout) Enable serde for Margin, Position, Rect, Size by @EdJoPaTo in #1255
-
36d49e5 (table) Select first, last, etc to table state by @robertpsoane in #1198
Add select_previous, select_next, select_first & select_last to
TableStateUsed equivalent API as in ListState
-
3bb374d (terminal) Add Terminal::try_draw() method by @joshka in #1209
This makes it easier to write fallible rendering methods that can use
the?
operatorterminal.try_draw(|frame| { some_method_that_can_fail()?; another_faillible_method()?; Ok(()) })?;
-
3725262 (text) Add
Add
andAddAssign
implementations forLine
,Span
, andText
by @joshka in #1236This enables:
let line = Span::raw("Red").red() + Span::raw("blue").blue(); let line = Line::raw("Red").red() + Span::raw("blue").blue(); let line = Line::raw("Red").red() + Line::raw("Blue").blue(); let text = Line::raw("Red").red() + Line::raw("Blue").blue(); let text = Text::raw("Red").red() + Line::raw("Blue").blue(); let mut line = Line::raw("Red").red(); line += Span::raw("Blue").blue(); let mut text = Text::raw("Red").red(); text += Line::raw("Blue").blue(); line.extend(vec![Span::raw("1"), Span::raw("2"), Span::raw("3")]);
-
c34fb77 (text) Remove unnecessary lifetime from ToText trait by @joshka in #1234 [breaking]
BREAKING CHANGE:The ToText trait no longer has a lifetime parameter.
This change simplifies the trait and makes it easier implement. -
c68ee6c (uncategorized) Add
get/set_cursor_position()
methods to Terminal and Backend by @EdJoPaTo in #1284 [breaking]The new methods return/accept
Into<Position>
which can be either a Position or a (u16, u16) tuple.backend.set_cursor_position(Position { x: 0, y: 20 })?; let position = backend.get_cursor_position()?; terminal.set_cursor_position((0, 20))?; let position = terminal.set_cursor_position()?;
-
b70cd03 (uncategorized) Add ListState / TableState scroll_down_by() / scroll_up_by() methods by @josueBarretogit in #1267
Implement new methods
scroll_down_by(u16)
andscroll_up_by(u16)
for
bothListstate
andTablestate
.Closes:#1207
Bug Fixes
-
864cd9f (testbackend) Prevent area mismatch by @EdJoPaTo in #1252
Removes the height and width fields from TestBackend, which can get
out of sync with the Buffer, which currently clamps to 255,255.This changes the
TestBackend
serde representation. It should be
possible to read older data, but data generated after this change
can't be read by older versions. -
7e1bab0 (buffer) Dont render control characters by @EdJoPaTo in #1226
-
c08b522 (chart) Allow removing all the axis labels by @EdJoPaTo in #1282
axis.labels(vec![])
removes all the labels correctly.This makes calling axis.labels with an empty Vec the equivalent
of not calling axis.labels. It's likely that this is never used, but it
prevents weird cases by removing the mix-up ofOption::None
andVec::is_empty
, and simplifies the implementation code. -
03f3124 (paragraph) Line_width, and line_count include block borders by @airblast-dev in #1235
The
line_width
, andline_count
methods forParagraph
would not
take into account theBlock
if one was set. This will now correctly
calculate the values including theBlock
's width/height.Fixes:#1233
-
3ca920e (span) Prevent panic on rendering out of y bounds by @EdJoPaTo in #1257
-
84cb164 (terminal) Make terminal module private by @joshka in #1260 [breaking]
This is a simplification of the public API that is helpful for new users
that are not familiar with how rust re-exports work, and helps avoid
clashes with other modules in the backends that are named terminal.BREAKING CHANGE:The
terminal
modul...
v0.28.0-alpha.1
v0.28.0-alpha.1 - 2024-08-03
Features
-
5b51018 (chart) Add GraphType::Bar by @joshka in #1205
-
5b89bd0 (layout) Add Size::ZERO and Position::ORIGIN constants by @EdJoPaTo in #1253
-
b2aa843 (layout) Enable serde for Margin, Position, Rect, Size by @EdJoPaTo in #1255
-
36d49e5 (table) Select first, last, etc to table state by @robertpsoane in #1198
Add select_previous, select_next, select_first & select_last to
TableStateUsed equivalent API as in ListState
-
3bb374d (terminal) Add Terminal::try_draw() method by @joshka in #1209
This makes it easier to write fallible rendering methods that can use
the?
operatorterminal.try_draw(|frame| { some_method_that_can_fail()?; another_faillible_method()?; Ok(()) })?;
-
3725262 (text) Add
Add
andAddAssign
implementations forLine
,Span
, andText
by @joshka in #1236This enables:
let line = Span::raw("Red").red() + Span::raw("blue").blue(); let line = Line::raw("Red").red() + Span::raw("blue").blue(); let line = Line::raw("Red").red() + Line::raw("Blue").blue(); let text = Line::raw("Red").red() + Line::raw("Blue").blue(); let text = Text::raw("Red").red() + Line::raw("Blue").blue(); let mut line = Line::raw("Red").red(); line += Span::raw("Blue").blue(); let mut text = Text::raw("Red").red(); text += Line::raw("Blue").blue(); line.extend(vec![Span::raw("1"), Span::raw("2"), Span::raw("3")]);
-
c34fb77 (text) Remove unnecessary lifetime from ToText trait by @joshka in #1234 [breaking]
BREAKING CHANGE:The ToText trait no longer has a lifetime parameter.
This change simplifies the trait and makes it easier implement.
Bug Fixes
-
7e1bab0 (buffer) Dont render control characters by @EdJoPaTo in #1226
-
03f3124 (paragraph) Line_width, and line_count include block borders by @airblast-dev in #1235
The
line_width
, andline_count
methods forParagraph
would not
take into account theBlock
if one was set. This will now correctly
calculate the values including theBlock
's width/height.Fixes:#1233
-
3ca920e (span) Prevent panic on rendering out of y bounds by @EdJoPaTo in #1257
-
84cb164 (terminal) Make terminal module private by @joshka in #1260 [breaking]
This is a simplification of the public API that is helpful for new users
that are not familiar with how rust re-exports work, and helps avoid
clashes with other modules in the backends that are named terminal.BREAKING CHANGE:The
terminal
module is now private and can not be
used directly. The types under this module are exported from the root of
the crate.- use ratatui::terminal::{CompletedFrame, Frame, Terminal, TerminalOptions, ViewPort}; + use ratatui::{CompletedFrame, Frame, Terminal, TerminalOptions, ViewPort};
Fixes:#1210
-
cd93547 (uncategorized) Remove unnecessary synchronization in layout cache by @SUPERCILEX in #1245
Layout::init_cache no longer returns bool and takes a NonZeroUsize instead of usize
The cache is a thread-local, so doesn't make much sense to require
synchronized initialization. -
b344f95 (uncategorized) Only apply style to first line when rendering a
Line
by @joshka in #1247A
Line
widget should only apply its style to the first line when
rendering and not the entire area. This is because theLine
widget
should only render a single line of text. This commit fixes the issue by
clamping the area to a single line before rendering the text. -
7ddfbc0 (uncategorized) Unnecessary allocations when creating Lines by @SUPERCILEX in #1237
-
84f3341 (uncategorized) Clippy lints from rust 1.80.0 by @joshka in #1238
Refactor
-
e81663b (list) Split up list.rs into smaller modules by @joshka in #1204
-
e707ff1 (uncategorized) Internally use Position struct by @EdJoPaTo in #1256
-
32a0b26 (uncategorized) Simplify WordWrapper implementation by @tranzystorekk in #1193
Documentation
-
6ce447c (block) Add docs about style inheritance by @joshka in #1190
Fixes:#1129
-
55e0880 (block) Update block documentation by @leohscl in #1206
Update block documentation with constructor methods and setter methods
in the main doc comment Added an example for using it to surround
widgetsFixes:#914
-
935a718 (examples) Add missing examples to README by @kibibyt3 in #1225
Resolves:#1014
-
50e5674 (examples) Fix: fix typos in tape files by @kibibyt3 in #1224
-
810da72 (examples) Fix hyperlink example tape by @kibibyt3 in #1222
Performance
-
663486f (list) Avoid extra allocations when rendering
List
by @airblast-dev in #1244When rendering a
List
, eachListItem
would be cloned. Removing the
clone, and replacingWidget::render
withWidgetRef::render_ref
saves
us allocations caused by the clone of theText<'_>
stored inside of
ListItem
.Based on the results of running the "list" benchmark locally;
Performance is improved by %1-3 for allrender
benchmarks forList
. -
be3eb75 (table) Avoid extra allocations when rendering
Table
by @airblast-dev in #1242When rendering a
Table
theText
stored inside of aCell
gets
cloned before rendering. This removes the clone and usesWidgetRef
instead, saving us from allocating aVec<Line<'_>>
insideText
. Also
...