v0.27.0-alpha.5
Pre-releasev0.27.0-alpha.5 - 2024-04-13
Features
-
1cff511
(line) Impl Styled for Line (#968)This adds `FromIterator` impls for `Line` and `Text` that allow creating `Line` and `Text` instances from iterators of `Span` and `Line` instances, respectively. ```rust let line = Line::from_iter(vec!["Hello".blue(), " world!".green()]); let line: Line = iter::once("Hello".blue()) .chain(iter::once(" world!".green())) .collect(); let text = Text::from_iter(vec!["The first line", "The second line"]); let text: Text = iter::once("The first line") .chain(iter::once("The second line")) .collect(); ```
-
654949b
(list) Add Scroll Padding to Lists (#958)Introduces scroll padding, which allows the api user to request that a certain number of ListItems be kept visible above and below the currently selected item while scrolling. ```rust let list = List::new(items).scroll_padding(1); ```
Fixes:#955
-
26af650
(text) Add push methods for text and line (#998)Adds the following methods to the `Text` and `Line` structs: - Text::push_line - Text::push_span - Line::push_span This allows for adding lines and spans to a text object without having to call methods on the fields directly, which is usefult for incremental construction of text objects.
-
b5bdde0
(text) AddFromIterator
impls forLine
andText
(#967)This adds `FromIterator` impls for `Line` and `Text` that allow creating `Line` and `Text` instances from iterators of `Span` and `Line` instances, respectively. ```rust let line = Line::from_iter(vec!["Hello".blue(), " world!".green()]); let line: Line = iter::once("Hello".blue()) .chain(iter::once(" world!".green())) .collect(); let text = Text::from_iter(vec!["The first line", "The second line"]); let text: Text = iter::once("The first line") .chain(iter::once("The second line")) .collect(); ```
-
12f67e8
(uncategorized) Impl Widget for&str
andString
(#952)Currently, `f.render_widget("hello world".bold(), area)` works but `f.render_widget("hello world", area)` doesn't. This PR changes that my implementing `Widget` for `&str` and `String`. This makes it easier to render strings with no styles as widgets. Example usage: ```rust terminal.draw(|f| f.render_widget("Hello World!", f.size()))?; ``` ---------
Bug Fixes
-
0207160
(line) Line truncation respects alignment (#987)When rendering a `Line`, the line will be truncated: - on the right for left aligned lines - on the left for right aligned lines - on bot sides for centered lines E.g. "Hello World" will be rendered as "Hello", "World", "lo wo" for left, right, centered lines respectively.
Fixes:#932
-
c56f49b
(list) Saturating_sub to fix highlight_symbol overflow (#949)An overflow (pedantically an underflow) can occur if the highlight_symbol is a multi-byte char, and area is reduced to a size less than that char length.
-
943c043
(scrollbar) Dont render on 0 length track (#964)Fixes a panic when `track_length - 1` is used. (clamp panics on `-1.0` being smaller than `0.0`)
-
742a5ea
(text) Fix panic when rendering out of bounds (#997)Previously it was possible to cause a panic when rendering to an area outside of the buffer bounds. Instead this now correctly renders nothing to the buffer.
-
f6c4e44
(uncategorized) Ensure that paragraph correctly renders styled text (#992)Paragraph was ignoring the new `Text::style` field added in 0.26.0
Fixes:#990
-
35e971f
(uncategorized) Scrollbar thumb not visible on long lists (#959)When displaying somewhat-long lists, the `Scrollbar` widget sometimes did not display a thumb character, and only the track will be visible.
Refactor
-
c12bcfe
(non-src) Apply pedantic lints (#976)Fixes many not yet enabled lints (mostly pedantic) on everything that is not the lib (examples, benchs, tests). Therefore, this is not containing anything that can be a breaking change. Lints are not enabled as that should be the job of #974. I created this as a separate PR as its mostly independent and would only clutter up the diff of #974 even more. Also see https://github.com/ratatui-org/ratatui/pull/974#discussion_r1506458743 ---------
-
8719608
(span) Rename to_aligned_line into into_aligned_line (#993)With the Rust method naming conventions these methods are into methods consuming the Span. Therefore, it's more consistent to use `into_` instead of `to_`. ```rust Span::to_centered_line Span::to_left_aligned_line Span::to_right_aligned_line ``` Are marked deprecated and replaced with the following ```rust Span::into_centered_line Span::into_left_aligned_line Span::into_right_aligned_line ```
-
359204c
(uncategorized) Simplify to io::Result (#1016)Simplifies the code, logic stays exactly the same.
-
8e68db9
(uncategorized) Remove pointless default on internal structs (#980)See #978
Also remove other derives. They are unused and just slow down
compilation.
-
3be189e
(uncategorized) Clippy::thread_local_initializer_can_be_made_const (#974)enabled by default on nightly
-
fdb14dc
(uncategorized) Clippy::redundant_type_annotations (#974) -
9b3b23a
(uncategorized) Remove literal suffix (#974)its not needed and can just be assumed
related:clippy::(un)separated_literal_suffix
-
58b6e0b
(uncategorized) Clippy::should_panic_without_expect (#974) -
c870a41
(uncategorized) Clippy::many_single_char_names (#974) -
fcbea9e
(uncategorized) Clippy::uninlined_format_args (#974) -
5ed1f43
(uncategorized) Clippy::redundant_closure_for_method_calls (#974) -
0de5238
(uncategorized) Dead_code (#974)enabled by default, only detected by nightly yet
-
df5dddf
(uncategorized) Unused_imports (#974)enabled by default, only detected on nightly yet
-
f1398ae
(uncategorized) Clippy::useless_vec (#974)Lint enabled by default but only nightly finds this yet
-
525848f
(uncategorized) Manually apply clippy::use_self for impl with lifetimes (#974) -
660c718
(uncategorized) Clippy::empty_line_after_doc_comments (#974) -
ab951fa
(uncategorized) Clippy::return_self_not_must_use (#974) -
9bc014d
(uncategorized) Clippy::items_after_statements (#974) -
8536760
(uncategorized) Clippy::inefficient_to_string (#974) -
27680c0
(uncategorized) Clippy::semicolon_if_nothing_returned (#974)
Documentation
Performance
-
e02f476
(borders) Allow border!() in const (#977)This allows more compiler optimizations when the macro is used.
-
541f0f9
(cell) Use const CompactString::new_inline (#979)Some minor find when messing around trying to `const` all the things. While `reset()` and `default()` can not be `const` it's still a benefit when their contents are.
-
65e7923
(scrollbar) Const creation (#963)A bunch of `const fn` allow for more performance and `Default` now uses the `const` new implementations.
-
8195f52
(uncategorized) Clippy::needless_pass_by_value (#974) -
183c07e
(uncategorized) Clippy::trivially_copy_pass_by_ref (#974) -
a13867f
(uncategorized) Clippy::cloned_instead_of_copied (#974)
Miscellaneous Tasks
-
125ee92
(docs) Fix: fix typos in crate documentation (#1002) -
07da90a
(funding) Add eth address for receiving funds from drips.network (#994) -
b0314c5
(uncategorized) Remove conventional commit check for PR (#950)This removes conventional commit check for PRs. Since we use the PR title and description this is useless. It fails a lot of time and we ignore it. IMPORTANT NOTE: This does **not** mean Ratatui abandons conventional commits. This only relates to commits in PRs.
Build
-
c4ce7e8
(uncategorized) Enable more satisfied lints (#974)These lints dont generate warnings and therefore dont need refactoring. I think they are useful in the future.
-
a4e84a6
(uncategorized) Increase msrv to 1.74.0 (#974) [breaking]configure lints in Cargo.toml requires 1.74.0
BREAKING CHANGE:rust 1.74 is required now