Skip to content

v0.27.0-alpha.5

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 13 Apr 00:13
· 264 commits to main since this release
b7778e5

v0.27.0-alpha.5 - 2024-04-13

Features

  • 11b452d
    (layout) Mark various functions as const (#951)

  • 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) Add FromIterator impls for Line and Text (#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 and String (#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.
    
  • b7778e5
    (paragraph) Unit test typo (#1022)

  • 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

  • 6fd5f63
    (lint) Prefer idiomatic for loops (#974)

  • 37b957c
    (lints) Add lints to scrollbar (#974)

  • 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
    ```
    
  • b831c56
    (widget-ref) Clippy::needless_pass_by_value (#974)

  • 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
    
  • 5c4efac
    (uncategorized) Clippy::map_err_ignore (#974)

  • bbb6d65
    (uncategorized) Clippy::else_if_without_else (#974)

  • 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)

  • a6036ad
    (uncategorized) Clippy::similar_names (#974)

  • 060d26b
    (uncategorized) Clippy::match_same_arms (#974)

  • fcbea9e
    (uncategorized) Clippy::uninlined_format_args (#974)

  • 14b24e7
    (uncategorized) Clippy::if_not_else (#974)

  • 5ed1f43
    (uncategorized) Clippy::redundant_closure_for_method_calls (#974)

  • c8c7924
    (uncategorized) Clippy::too_many_lines (#974)

  • e3afe7c
    (uncategorized) Clippy::unreadable_literal (#974)

  • a1f54de
    (uncategorized) Clippy::bool_to_int_with_if (#974)

  • b8ea190
    (uncategorized) Clippy::cast_lossless (#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)

  • 3cd4369
    (uncategorized) Clippy::doc_markdown (#974)

  • 9bc014d
    (uncategorized) Clippy::items_after_statements (#974)

  • 36a0cd5
    (uncategorized) Clippy::deref_by_slicing (#974)

  • f7f6692
    (uncategorized) Clippy::equatable_if_let (#974)

  • 01418eb
    (uncategorized) Clippy::default_trait_access (#974)

  • 8536760
    (uncategorized) Clippy::inefficient_to_string (#974)

  • a558b19
    (uncategorized) Clippy::implicit_clone (#974)

  • 5b00e3a
    (uncategorized) Clippy::use_self (#974)

  • 27680c0
    (uncategorized) Clippy::semicolon_if_nothing_returned (#974)

Documentation

  • 14461c3
    (breaking-changes) Typos and markdownlint (#1009)

  • d0067c8
    (license) Update copyright years (#962)

  • 88bfb5a
    (text) Update Text and Line docs (#969)

  • 3b002fd
    (uncategorized) Update incompatible code warning in examples readme (#1013)

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)

  • 3834374
    (uncategorized) Clippy::missing_const_for_fn (#974)

Miscellaneous Tasks

  • 125ee92
    (docs) Fix: fix typos in crate documentation (#1002)

  • 38c17e0
    (editorconfig) Set and apply some defaults (#974)

  • 07da90a
    (funding) Add eth address for receiving funds from drips.network (#994)

  • 078e97e
    (github) Add EdJoPaTo as a maintainer (#986)

  • 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

  • 6e6ba27
    (lint) Warn on pedantic and allow the rest (#974)

  • 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