netop icon indicating copy to clipboard operation
netop copied to clipboard

fix(deps): update rust crate ratatui to 0.29.0

Open renovate[bot] opened this issue 1 year ago • 0 comments

This PR contains the following updates:

Package Type Update Change
ratatui (source) dependencies minor 0.25.0 -> 0.29.0

Release Notes

ratatui/ratatui (ratatui)

v0.29.0

Compare Source

Features
  • 3a43274 (color) Add hsluv support by @​du-ob in #​1333

  • 4c4851c (example) Add drawing feature to the canvas example by @​orhun in #​1429

    rec_20241018T235208

    fun fact: I had to do 35 pushups for this...


  • e5a7609 (line) Impl From<Cow> for Line by @​joshka in #​1373 [breaking]

    BREAKING-CHANGES:Line now implements From<Cow<str>

    As this adds an extra conversion, ambiguous inferred values may no longer compile.

    // given:
    struct Foo { ... }
    impl From<Foo> for String { ... }
    impl From<Foo> for Cow<str> { ... }
    
    let foo = Foo { ... };
    let line = Line::from(foo); // now fails due to ambiguous type inference
    // replace with
    let line = Line::from(String::from(foo));
    

    Fixes:https://github.com/ratatui/ratatui/issues/1367


  • 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 the examples/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());
    }
    
  • d72968d (scrolling-regions) Use terminal scrolling regions to stop Terminal::insert_before from flickering by @​nfachan in #​1341 [breaking]

    The current implementation of Terminal::insert_before causes the viewport to flicker. This is described in #​584 .

    This PR removes that flickering by using terminal scrolling regions (sometimes called "scroll regions"). A terminal can have its scrolling region set to something other than the whole screen. When a scroll ANSI sequence is sent to the terminal and it has a non-default scrolling region, the terminal will scroll just inside of that region.

    We use scrolling regions to implement insert_before. We create a region on the screen above the viewport, scroll that up to make room for the newly inserted lines, and then draw the new lines. We may need to repeat this process depending on how much space there is and how many lines we need to draw.

    When the viewport takes up the entire screen, we take a modified approach. We create a scrolling region of just the top line (could be more) of the viewport, then use that to draw the lines we want to output. When we're done, we scroll it up by one line, into the scrollback history, and then redraw the top line from the viewport.

    A final edge case is when the viewport hasn't yet reached the bottom of the screen. This case, we set up a different scrolling region, where the top is the top of the viewport, and the bottom is the viewport's bottom plus the number of lines we want to scroll by. We then scroll this region down to open up space above the viewport for drawing the inserted lines.

    Regardless of what we do, we need to reset the scrolling region. This PR takes the approach of always resetting the scrolling region after every operation. So the Backend gets new scroll_region_up and scroll_region_down methods instead of set_scrolling_region, scroll_up, scroll_down, and reset_scrolling_region methods. We chose that approach for two reasons. First, we don't want Ratatui to have to remember that state and then reset the scrolling region when tearing down. Second, the pre-Windows-10 console code doesn't support scrolling region

    This PR:

    • Adds a new scrolling-regions feature.
    • Adds two new Backend methods: scroll_region_up and scroll_region_down.
    • Implements those Backend methods on all backends in the codebase.
    • The crossterm and termion implementations use raw ANSI escape sequences. I'm trying to merge changes into those two projects separately to support these functions.
    • Adds code to Terminal::insert_before to choose between insert_before_scrolling_regions and insert_before_no_scrolling_regions. The latter is the old implementation.
    • Adds lots of tests to the TestBackend to for the scrolling-region-related Backend methods.
    • Adds versions of terminal tests that show that insert_before doesn't clobber the viewport. This is a change in behavior from before.
  • dc8d058 (table) Add support for selecting column and cell by @​airblast-dev in #​1331 [breaking]

    Fixes https://github.com/ratatui-org/ratatui/issues/1250

    Adds support for selecting a column and cell in TableState. The selected column, and cells style can be set by Table::column_highlight_style and Table::cell_highlight_style respectively.

    The table example has also been updated to display the new functionality:

    https://github.com/user-attachments/assets/e5fd2858-4931-4ce1-a2f6-a5ea1eacbecc

    BREAKING CHANGE:The Serialized output of the state will now include the "selected_column" field. Software that manually parse the serialized the output (with anything other than the Serialize implementation on TableState) may have to be refactored if the "selected_column" field is not accounted for. This does not affect users who rely on the Deserialize, or Serialize implementation on the state.

    BREAKING CHANGE:The Table::highlight_style is now deprecated in favor of Table::row_highlight_style.


  • ab6b1fe (tabs) Allow tabs to be deselected by @​joshka in #​1413 [breaking]

    Tabs::select() now accepts Into<Option<usize>> instead of usize. This allows tabs to be deselected by passing None.

    Tabs::default() is now also implemented manually instead of deriving Default, and a new method Tabs::titles() is added to set the titles of the tabs.

    Fixes:#​1412

    BREAKING CHANGE:Tabs::select() now accepts Into<Option<usize>> which breaks any code already using parameter type inference:

    let selected = 1u8;
    - let tabs = Tabs::new(["A", "B"]).select(selected.into())
    + let tabs = Tabs::new(["A", "B"]).select(selected as usize)
    
  • 23c0d52 (text) Improve concise debug view for Span,Line,Text,Style by @​joshka in #​1410

    Improves https://github.com/ratatui/ratatui/pull/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()
    
  • 60cc15b (uncategorized) Add support for empty bar style to Sparkline by @​fujiapple852 in #​1326 [breaking]

    • distinguish between empty bars and bars with a value of 0
    • provide custom styling for empty bars
    • provide custom styling for individual bars
    • inverts the rendering algorithm to be item first

    Closes:#​1325

    BREAKING CHANGE:Sparkline::data takes IntoIterator<Item = SparklineBar> instead of &[u64] and is no longer const

  • 453a308 (uncategorized) Add overlap to layout by @​kdheepak in #​1398 [breaking]

    This PR adds a new feature for the existing Layout::spacing method, and introducing a Spacing enum.

    Now Layout::spacing is generic and can take

    • zero or positive numbers, e.g. Layout::spacing(1) (current functionality)
    • negative number, e.g. Layout::spacing(-1) (new)
    • variant of the Spacing (new)

    This allows creating layouts with a shared pixel for segments. When spacing(negative_value) is used, spacing is ignored and all segments will be adjacent and have pixels overlapping. spacing(zero_or_positive_value) behaves the same as before. These are internally converted to Spacing::Overlap or Spacing::Space.

    Here's an example output to illustrate the layout solve from this PR:

    #[test]
    fn test_layout() {
        use crate::layout::Constraint::*;
        let mut terminal = crate::Terminal::new(crate::backend::TestBackend::new(50, 4)).unwrap();
        terminal
            .draw(|frame| {
                let [upper, lower] = Layout::vertical([Fill(1), Fill(1)]).areas(frame.area());
    
                let (segments, spacers) = Layout::horizontal([Length(10), Length(10), Length(10)])
                    .flex(Flex::Center)
                    .split_with_spacers(upper);
    
                for segment in segments.iter() {
                    frame.render_widget(
                        crate::widgets::Block::bordered()
                            .border_set(crate::symbols::border::DOUBLE),
                        *segment,
                    );
                }
                for spacer in spacers.iter() {
                    frame.render_widget(crate::widgets::Block::bordered(), *spacer);
                }
    
                let (segments, spacers) = Layout::horizontal([Length(10), Length(10), Length(10)])
                    .flex(Flex::Center)
                    .spacing(-1) // new feature
                    .split_with_spacers(lower);
    
                for segment in segments.iter() {
                    frame.render_widget(
                        crate::widgets::Block::bordered()
                            .border_set(crate::symbols::border::DOUBLE),
                        *segment,
                    );
                }
                for spacer in spacers.iter() {
                    frame.render_widget(crate::widgets::Block::bordered(), *spacer);
                }
            })
            .unwrap();
        dbg!(terminal.backend());
    }
    
    ┌────────┐╔════════╗╔════════╗╔════════╗┌────────┐
    └────────┘╚════════╝╚════════╝╚════════╝└────────┘
    ┌─────────┐╔════════╔════════╔════════╗┌─────────┐
    └─────────┘╚════════╚════════╚════════╝└─────────┘
    

    Currently drawing a border on top of an existing border overwrites it. Future PRs will allow for making the border drawing handle overlaps better.


  • 7bdccce (uncategorized) Add an impl of DoubleEndedIterator for Columns and Rows by @​fujiapple852 [breaking]

    BREAKING-CHANGE:The pub modifier has been removed from fields on the

    layout::rect::Columns and layout::rect::Rows iterators. These fields were not intended to be public and should not have been accessed directly.

    Fixes:#​1357

Bug Fixes
  • 4f5503d (color) Hsl and hsluv are now clamped before conversion by @​joshka in #​1436 [breaking]

    The from_hsl and from_hsluv functions now clamp the HSL and HSLuv values before converting them to RGB. This ensures that the input values are within the expected range before conversion.

    Also note that the ranges of Saturation and Lightness values have been aligned to be consistent with the palette crate. Saturation and Lightness for from_hsl are now in the range [0.0..1.0] while from_hsluv are in the range [0.0..100.0].

    Refs:- https://redirect.github.com/Ogeon/palette/discussions/253

    Fixes:#​1433

  • b7e4885 (color) Fix doc test for from_hsl by @​joshka in #​1421

  • 3df685e (rect) Rect::area now returns u32 and Rect::new() no longer clamps area to u16::MAX by @​joshka in #​1378 [breaking]

    This change fixes the unexpected behavior of the Rect::new() function to be more intuitive. The Rect::new() function now clamps the width and height of the rectangle to keep each bound within u16::MAX. The Rect::area() function now returns a u32 instead of a u16 to allow for larger areas to be calculated.

    Previously, the Rect::new() function would clamp the total area of the rectangle to u16::MAX, by preserving the aspect ratio of the rectangle.

    BREAKING CHANGE:Rect::area() now returns a u32 instead of a u16.

    Fixes:#​1375

  • 514d273 (terminal) Use the latest, resized area when clearing by @​roberth in #​1427

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

  • a52ee82 (text) Truncate based on alignment by @​Lunderberg in #​1432

    This is a follow-up PR to https://github.com/ratatui/ratatui/pull/987, which implemented alignment-aware truncation for the Line widget. However, the truncation only checked the Line::alignment field, and any alignment inherited from a parent's Text::alignment field would not be used.

    This commit updates the truncation of Line to depend both on the individual Line::alignment, and on any alignment inherited from the parent's Text::alignment.

  • 611086e (uncategorized) Sparkline docs / doc tests by @​joshka in #​1437

  • 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

    https://github.com/ratatui/ratatui/pull/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
  • 6db16d6 (color) Use palette types for Hsl/Hsluv conversions by @​orhun in #​1418 [breaking]

    BREAKING-CHANGE:Previously Color::from_hsl accepted components as individual f64 parameters. It now accepts a single palette::Hsl value and is gated behind a palette feature flag.

    - Color::from_hsl(360.0, 100.0, 100.0)
    + Color::from_hsl(Hsl::new(360.0, 100.0, 100.0))
    

    Fixes:#​1414


  • edcdc8a (layout) Rename element to segment in layout by @​kdheepak in #​1397

    This PR renames element to segment in a couple of functions in the layout calculations for clarity. element can refer to segments or spacers and functions that take only segments should use segment as the variable names.

  • 1153a9e (uncategorized) Consistent result expected in layout tests by @​farmeroy in #​1406

    Fixes #​1399 I've looked through all the assert_eq and made sure that they follow the expected, 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
Performance
Styling
Miscellaneous Tasks
  • 67c0ea2 (block) Deprecate block::Title by @​joshka in #​1372

    ratatui::widgets::block::Title is deprecated in favor of using Line 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:

    #​738

    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"));
    
  • 6515097 (cargo) Check in Cargo.lock by @​joshka in #​1434

    When kept up to date, this makes it possible to build any git version with the same versions of crates that were used for any version, without it, you can only use the current versions. This makes bugs in semver compatible code difficult to detect.

    The Cargo.lock file is not used by downstream consumers of the crate, so it is safe to include it in the repository (and recommended by the Rust docs).

    See:- https://doc.rust-lang.org/cargo/faq.html#why-have-cargolock-in-version-control

  • 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

  • 69e0cd2 (deny) Allow Zlib license in cargo-deny configuration by @​orhun in #​1411

  • 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: https://github.com/ratatui/ratatui/issues/1382


  • f6f7794 (uncategorized) Remove leftover prelude refs / glob imports from example code by @​joshka in #​1430

    Fixes:#​1150

  • 9fd1bee (uncategorized) Make Positions iterator fields private by @​joshka in #​1424 [breaking]

    BREAKING CHANGE:The Rect Positions iterator no longer has public fields. The rect and current_position fields have been made private as they were not intended to be accessed directly.

  • 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 (deps) Pin unicode-width to 0.2.0 by @​orhun in #​1403 [breaking]

    We pin unicode-width to avoid breaking applications when there are breaking changes in the library.

    Discussion in #​1271

Continuous Integration
  • 5635b93 (uncategorized) Add cargo-machete and remove unused deps by @​Veetaha in #​1362

    https://github.com/bnjbvr/cargo-machete

New Contributors

Full Changelog: https://github.com/ratatui/ratatui/compare/v0.28.1...v0.29.0

v0.28.1

Compare Source

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() and try_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 the init and restore functions over these functions.

    Corresponding functions to allow passing a TerminalOptions with a Viewport (e.g. inline, fixed) are also available (init_with_options, and try_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 functions Terminal::draw_lines and Terminal::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:https://github.com/ratatui/ratatui/issues/999

  • 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
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 in RELEASE.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

  • 8b624f5 (maintainers) Remove EdJoPaTo by @​EdJoPaTo in #​1314

  • 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

Full Changelog: https://github.com/ratatui/ratatui/compare/v0.28.0...v0.28.1

v0.28.0

Compare Source

"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/

⚠️ List of breaking changes can be found here.

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) or buf.get_mut(x, y) should now use index operators, or be transitioned to buff.cell() or buf.cell_mut() for safe access that avoids panics by returning Option<&Cell> and Option<&mut Cell>.

    The new methods accept Into<Position> instead of x and y 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() and get_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

    Demo

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

    Used 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 ? operator

    terminal.try_draw(|frame| {
        some_method_that_can_fail()?;
        another_faillible_method()?;
        Ok(())
    })?;
    
  • 3725262 (text) Add Add and AddAssign implementations for Line, Span, and Text by @​joshka in #​1236

    This 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) and scroll_up_by(u16) for both Liststate and Tablestate.

    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 of Option::None and Vec::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, and line_count methods for Paragraph would not take into account the Block if one was set. This will now correctly calculate the values including the Block'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

  • 29c8c84 (uncategorized) Ignore newlines in Span's Display impl by @​SUPERCILEX in #​1270

  • 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 #​1247

    A Line widget should only apply its style to the first line when rendering and not the entire area. This is because the Line 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

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

renovate[bot] avatar Feb 02 '24 19:02 renovate[bot]