v0.26.3
https://github.com/ratatui/ratatui/releases/tag/v0.26.3
Ratatui Forum ๐
We are happy to announce a brand new Ratatui Forum ๐ญ for Rust & TUI enthusiasts.
Join here: https://forum.ratatui.rs
Here you can get help with your Rust/Ratatui questions and share your projects!
Fix Unicode Truncation Bug ๐
If you are using Ratatui 0.26.2
you might have hit this bug:
panic occurred at
ratatui-0.26.2/src/text/line.rs:477:59
byte index 51 is not a char boundary; it is inside โใงโ (bytes 49..52) of๐ฆ RFC8628 OAuth 2.0 Device Authorization GrantใงCLIใใGithubใฎaccess tokenใๅๅพใใ
This issue was introduced in this PR and now fixed
with 0.26.3
!
- Details: https://github.com/ratatui/ratatui/issues/1032
- Implementation: https://github.com/ratatui/ratatui/pull/1089
Color: Better Serialization ๐จ
Color::Rgb
will now be serialized as the hex representation of their value.
For example, Color::Rgb(255, 0, 255)
would be serialized as "#FF00FF"
rather than
{"Rgb": [255, 0, 255]}
:
Similarly, Color::Indexed
will now be serialized as just the string of the index.
For example, with serde_json, Color::Indexed(10)
would be serialized as "10"
rather than
{"Indexed": 10}
:
Faster Rendering ๐
We sped up combined foreground and background color changes for the crossterm
backend by up to
20%! ๐ฅ
For more information, see:
I changed the SetColors command to write both colors at once with a single write instead of multiple writes that more bytes. This led to a 15-25% fps increase when testing the colors_rgb example on iTerm2 on an M2 Macbook Pro.
Deprecate assert_buffer_eq
macro ๐ซ
assert_buffer_eq
is now
deprecated in favor of the standard assert_eq
macro:
We also introduced TestBackend::assert_buffer_lines
for checking if TestBackend
โs buffer is
equal to the expected lines.
Here is an example usage:
So the usage can be simplified as follows:
Use Block::bordered
๐ฆ
Throughout the codebase we switched to the new way of creating bordered Blocks: Block::bordered
This was added in 0.26 and it requires one less import!
Exposed Error Type ๐
Have you ever tried to wrap ParseColorError
in your custom error implementation?
This is now possible since ParseColorError
is re-exported as ratatui::style::ParseColorError
!
Constants โพ๏ธ
We made improvements in some widgets to make use of constant functions and types:
- Make
TableState::new
constant (#1040) - Change canvas map data to const instead of static (#1037)
- Use constant function for calendar (#1039)
Other ๐ผ
- Improve performance!
- Changed user_input example to work with multi-byte unicode chars (#1069)
- Handle ZWSP (allow wrapping at zero width whitespace) (#1074)
- Fix the Debug panic in Buffer (#1098)
- Track caller for index_of method of Buffer (#1046)
- Simplify test cases using
rstest
(#1095) - Enable and fix some clippy lints (including
clippy::cargo_common_metadata
andclippy::cargo
) - Update crate metadata such as keywords and homepage