Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust crate ratatui to 0.28.0 #6267

Merged
merged 3 commits into from
Aug 10, 2024
Merged

Update Rust crate ratatui to 0.28.0 #6267

merged 3 commits into from
Aug 10, 2024

Conversation

oxide-renovate[bot]
Copy link
Contributor

@oxide-renovate oxide-renovate bot commented Aug 8, 2024

This PR contains the following updates:

Package Type Update Change
ratatui (source) workspace.dependencies minor 0.27.0 -> 0.28.0

Release Notes

ratatui-org/ratatui (ratatui)

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:https://github.com/ratatui-org/ratatui/issues/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: https://github.com/ratatui-org/ratatui/issues/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:https://github.com/ratatui-org/ratatui/pull/1254#issuecomment-2268061409

  • 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:https://github.com/ratatui-org/ratatui/issues/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
Documentation
Performance
  • 663486f (list) Avoid extra allocations when rendering List by @​airblast-dev in #​1244

    When rendering a List, each ListItem would be cloned. Removing the
    clone, and replacing Widget::render with WidgetRef::render_ref saves
    us allocations caused by the clone of the Text<'_> stored inside of
    ListItem.

    Based on the results of running the "list" benchmark locally;
    Performance is improved by %1-3 for all render benchmarks for List.

  • 4753b72 (reflow) Eliminate most WordWrapper allocations by @​SUPERCILEX in #​1239

    On large paragraphs (~1MB), this saves hundreds of thousands of
    allocations.

    TL;DR:reuse as much memory as possible across next_line calls.
    Instead of allocating new buffers each time, allocate the buffers once
    and clear them before reuse.

  • be3eb75 (table) Avoid extra allocations when rendering Table by @​airblast-dev in #​1242

    When rendering a Table the Text stored inside of a Cell gets
    cloned before rendering. This removes the clone and uses WidgetRef
    instead, saving us from allocating a Vec<Line<'_>> inside Text. Also
    avoids an allocation when rendering the highlight symbol if it contains
    an owned value.

  • f04bf85 (uncategorized) Add buffer benchmarks by @​joshka in #​1303

  • e6d2e04 (uncategorized) Move benchmarks into a single benchmark harness by @​joshka in #​1302

    Consolidates the benchmarks into a single executable rather than having
    to create a new cargo.toml setting per and makes it easier to rearrange
    these when adding new benchmarks.

Styling
  • a80a8a6 (format) Lint markdown by @​joshka in #​1131

    • chore: Fix line endings for changelog
    • chore: cleanup markdown lints
    • ci: add Markdown linter
    • build: add markdown lint to the makefile

Testing
Miscellaneous Tasks
Build
Continuous Integration
  • 476ac87 (uncategorized) Split up lint job by @​EdJoPaTo in #​1264

    This helps with identifying what failed right from the title. Also steps
    after a failing one are now always executed.

    Also shortens the steps a bit by removing obvious names.

New Contributors

Full Changelog: ratatui/ratatui@v0.27.0...0.28.0


Configuration

📅 Schedule: Branch creation - "after 8pm,before 6am" in timezone America/Los_Angeles, Automerge - "after 8pm,before 6am" in timezone America/Los_Angeles.

🚦 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 has been generated by Renovate Bot.

@oxide-renovate oxide-renovate bot added the dependencies Pull requests that update a dependency file label Aug 8, 2024
@oxide-renovate
Copy link
Contributor Author

oxide-renovate bot commented Aug 8, 2024

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: Cargo.lock
Command failed: cargo update --config net.git-fetch-with-cli=true --manifest-path Cargo.toml --package [email protected] --precise 0.28.0
    Updating crates.io index
error: failed to select a version for the requirement `ratatui = "^0.27"`
candidate versions found which didn't match: 0.28.0
location searched: crates.io index
required by package `tui-tree-widget v0.21.0`
    ... which satisfies dependency `tui-tree-widget = "^0.21.0"` (locked to 0.21.0) of package `wicket v0.1.0 (/tmp/renovate/repos/github/oxidecomputer/omicron/wicket)`
    ... which satisfies path dependency `wicket` (locked to 0.1.0) of package `wicket-dbg v0.1.0 (/tmp/renovate/repos/github/oxidecomputer/omicron/wicket-dbg)`

@sunshowers sunshowers enabled auto-merge (squash) August 10, 2024 22:50
@oxide-renovate
Copy link
Contributor Author

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@sunshowers sunshowers merged commit c5778af into main Aug 10, 2024
24 checks passed
@sunshowers sunshowers deleted the renovate/ratatui-0.x branch August 10, 2024 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant