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.27.0 #5850

Merged
merged 3 commits into from
Jul 6, 2024
Merged

Update Rust crate ratatui to 0.27.0 #5850

merged 3 commits into from
Jul 6, 2024

Conversation

oxide-renovate[bot]
Copy link
Contributor

@oxide-renovate oxide-renovate bot commented Jun 1, 2024

This PR contains the following updates:

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

Release Notes

ratatui-org/ratatui (ratatui)

v0.27.0

Compare Source

In this version, we have focused on enhancing usability and functionality with new features like
background styles for LineGauge, palette colors, and various other improvements including
improved performance. Also, we added brand new examples for tracing and creating hyperlinks!

Release highlights: https://ratatui.rs/highlights/v027/

⚠️ List of breaking changes can be found here.

Features
  • eef1afe (linegauge) Allow LineGauge background styles by @​nowNick in #​565

    This PR deprecates `gauge_style` in favor of `filled_style` and
    `unfilled_style` which can have it's foreground and background styled.
    
    `cargo run --example=line_gauge --features=crossterm`
    
    line_gauge_demo.mov

    Implements:#​424

  • 1365620 (borders) Add FULL and EMPTY border sets by @​joshka in #​1182

    border::FULL uses a full block symbol, while border::EMPTY uses an
    empty space. This is useful for when you need to allocate space for the
    border and apply the border style to a block without actually drawing a
    border. This makes it possible to style the entire title area or a block
    rather than just the title content.

use ratatui::{symbols::border, widgets::Block};
let block = Block::bordered().title("Title").border_set(border::FULL);
let block = Block::bordered().title("Title").border_set(border::EMPTY);
cargo run --example tracing
RUST_LOG=trace cargo run --example=tracing
cat tracing.log

Made with VHS

  • 1520ed9 (layout) Impl Display for Position and Size by @​joshka in #​1162

  • 46977d8 (list) Add list navigation methods (first, last, previous, next) by @​joshka in #​1159 [breaking]

    Also cleans up the list example significantly (see also
    <https://github.com/ratatui-org/ratatui/issues/1157>)
    

    Fixes:#​1159

    BREAKING CHANGE:The List widget now clamps the selected index to the
    bounds of the list when navigating with first, last, previous, and
    next, as well as when setting the index directly with select.

  • 10d7788 (style) Add conversions from the palette crate colors by @​joshka in #​1172

    This is behind the "palette" feature flag.
    
    ```rust
    use palette::{LinSrgb, Srgb};
    use ratatui::style::Color;
    
    let color = Color::from(Srgb::new(1.0f32, 0.0, 0.0));
    let color = Color::from(LinSrgb::new(1.0f32, 0.0, 0.0));
    ```
    
  • 7ef2dae (text) support conversion from Display to Span, Line and Text by @​orhun in #​1167

    Now you can create `Line` and `Text` from numbers like so:
    
    ```rust
    let line = 42.to_line();
    let text = 666.to_text();
    ```
    
  • 74a32af (uncategorized) Re-export backends from the ratatui crate by @​joshka in #​1151

    `crossterm`, `termion`, and `termwiz` can now be accessed as
    `ratatui::{crossterm, termion, termwiz}` respectively. This makes it
    possible to just add the Ratatui crate as a dependency and use the
    backend of choice without having to add the backend crates as
    dependencies.
    
    To update existing code, replace all instances of `crossterm::` with
    `ratatui::crossterm::`, `termion::` with `ratatui::termion::`, and
    `termwiz::` with `ratatui::termwiz::`.
    
  • 3594180 (uncategorized) Make Stylize's .bg(color) generic by @​kdheepak in #​1103 [breaking]

  • 0b5fd6b (uncategorized) Add writer() and writer_mut() to termion and crossterm backends by @​enricozb in #​991

    It is sometimes useful to obtain access to the writer if we want to see
    what has been written so far. For example, when using &mut [u8] as a
    writer.
    
Bug Fixes
Refactor
- list.start_corner(Corner::TopLeft);
- list.start_corner(Corner::TopRight);
// This is not an error, BottomRight rendered top to bottom previously
- list.start_corner(Corner::BottomRight);
// all becomes
+ list.direction(ListDirection::TopToBottom);
- list.start_corner(Corner::BottomLeft);
// becomes
+ list.direction(ListDirection::BottomToTop);

layout::Corner is removed entirely.

  • 4f77910 (padding) Add Padding::ZERO as a constant by @​EdJoPaTo in #​1133

    Deprecate Padding::zero()
    
  • 8061813 (uncategorized) Expand glob imports by @​joshka in #​1152

    Consensus is that explicit imports make it easier to understand the
    example code. This commit removes the prelude import from all examples
    and replaces it with the necessary imports, and expands other glob
    imports (widget::*, Constraint::*, KeyCode::*, etc.) everywhere else.
    Prelude glob imports not in examples are not covered by this PR.
    
    See https://github.com/ratatui-org/ratatui/issues/1150 for more details.
    
  • d929971 (uncategorized) Dont manually impl Default for defaults by @​EdJoPaTo in #​1142

    Replace `impl Default` by `#[derive(Default)]` when its implementation
    equals.
    
  • 8a60a56 (uncategorized) Needless_pass_by_ref_mut by @​EdJoPaTo in #​1137

    https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

  • 1de9a82 (uncategorized) Simplify if let by @​EdJoPaTo in #​1135

    While looking through lints
    [`clippy::option_if_let_else`](https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else)
    found these. Other findings are more complex so I skipped them.
    
Documentation
Performance
-let area = area.inner(&Margin {
+let area = area.inner(Margin {
     vertical: 0,
     horizontal: 2,
 });
Styling
Testing
Miscellaneous Tasks
  • 7b45f74 (prelude) Add / remove items by @​joshka in #​1149 [breaking]

    his PR removes the items from the prelude that don't form a coherent
    common vocabulary and adds the missing items that do.
    
    Based on a comment at
    <https://www.reddit.com/r/rust/comments/1cle18j/comment/l2uuuh7/>
    

    BREAKING CHANGE:The following items have been removed from the prelude:

  • style::Styled - this trait is useful for widgets that want to
    support the Stylize trait, but it adds complexity as widgets have two
    style methods and a set_style method.

  • symbols::Marker - this item is used by code that needs to draw to
    the Canvas widget, but it's not a common item that would be used by
    most users of the library.

  • terminal::{CompletedFrame, TerminalOptions, Viewport} - these items
    are rarely used by code that needs to interact with the terminal, and
    they're generally only ever used once in any app.

The following items have been added to the prelude:

  • layout::{Position, Size} - these items are used by code that needs
    to interact with the layout system. These are newer items that were
    added in the last few releases, which should be used more liberally.

  • cd64367 (symbols) Add tests for line symbols by @​joshka in #​1186

  • 8cfc316 (uncategorized) Alphabetize examples in Cargo.toml by @​joshka in #​1145

Build
  • 70df102 (bench) Improve benchmark consistency by @​EdJoPaTo in #​1126

    Codegen units are optimized on their own. Per default bench / release
    have 16 codegen units. What ends up in a codeget unit is rather random
    and can influence a benchmark result as a code change can move stuff
    into a different codegen unit → prevent / allow LLVM optimizations
    unrelated to the actual change.
    
    More details: https://doc.rust-lang.org/cargo/reference/profiles.html
    
New Contributors

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

v0.26.3

Compare Source

We are happy to announce a brand new Ratatui Forum 🐭 for Rust & TUI enthusiasts.

This is a patch release that fixes the unicode truncation bug, adds performance and quality of life improvements.

Release highlights: https://ratatui.rs/highlights/v0263/

Features
Bug Fixes
  • 366cbae (buffer) Fix Debug panic and fix formatting of overridden parts by @​EdJoPaTo in #​1098

    Fix panic in `Debug for Buffer` when `width == 0`.
    Also corrects the output when symbols are overridden.
    
  • 4392759 (examples) Changed user_input example to work with multi-byte unicode chars by @​OkieOth in #​1069

    This is the proposed solution for issue #&#8203;1068. It solves the bug in the
    user_input example with multi-byte UTF-8 characters as input.
    

    Fixes:#​1068


  • 20fc0dd (examples) Fix key handling in constraints by @​psobolik in #​1066

    Add check for `KeyEventKind::Press` to constraints example's event
    handler to eliminate double keys
    on Windows.
    

    Fixes:#​1062


  • f4637d4 (reflow) Allow wrapping at zero width whitespace by @​kxxt in #​1074

  • 699c2d7 (uncategorized) Unicode truncation bug by @​joshka in #​1089

    - Rewrote the line / span rendering code to take into account how
    multi-byte / wide emoji characters are truncated when rendering into
    areas that cannot accommodate them in the available space
    - Added comprehensive coverage over the edge cases
    - Adds a benchmark to ensure perf
    

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

  • b30411d (uncategorized) Termwiz underline color test by @​joshka in #​1094

    Fixes code that doesn't compile in the termwiz tests when
    underline-color feature is enabled.
    
  • 5f1e119 (uncategorized) Correct feature flag typo for termwiz by @​joshka in #​1088

    underline-color was incorrectly spelt as underline_color
    
  • 0a16496 (uncategorized) Use to_string to serialize Color by @​SleepySwords in #​934

    Since deserialize now uses `FromStr` to deserialize color, serializing
    `Color` RGB values, as well as index values, would produce an output
    that would no longer be able to be deserialized without causing an
    error.
    

    Color::Rgb will now be serialized as the hex representation of their
    value.
    For example, with serde_json, Color::Rgb(255, 0, 255) would be
    serialized as "#FF00FF" rather than {"Rgb": [255, 0, 255]}.

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

Other color variants remain the same.

Refactor
  • 2cfe82a (buffer) Deprecate assert_buffer_eq! in favor of assert_eq! by @​EdJoPaTo in #​1007

    - Simplify `assert_buffer_eq!` logic.
    - Deprecate `assert_buffer_eq!`.
    - Introduce `TestBackend::assert_buffer_lines`.
    
    Also simplify many tests involving buffer comparisons.
    
    For the deprecation, just use `assert_eq` instead of `assert_buffer_eq`:
    
    ```diff
    -assert_buffer_eq!(actual, expected);
    +assert_eq!(actual, expected);
    ```
    
    ---
    
    I noticed `assert_buffer_eq!` creating no test coverage reports and
    looked into this macro. First I simplified it. Then I noticed a bunch of
    `assert_eq!(buffer, …)` and other indirect usages of this macro (like
    `TestBackend::assert_buffer`).
    
    The good thing here is that it's mainly used in tests so not many
    changes to the library code.
    
  • baedc39 (buffer) Simplify set_stringn logic by @​EdJoPaTo in #​1083

  • 9bd89c2 (clippy) Enable breaking lint checks by @​EdJoPaTo in #​988

    We need to make sure to not change existing methods without a notice.
    But at the same time this also finds public additions with mistakes
    before they are even released which is what I would like to have.
    
    This renames a method and deprecated the old name hinting to a new name.
    Should this be mentioned somewhere, so it's added to the release notes?
    It's not breaking because the old method is still there.
    
  • bef5bcf (example) Remove pointless new method by @​EdJoPaTo in #​1038

    Use `App::default()` directly.
    
  • f3172c5 (gauge) Fix internal typo by @​EdJoPaTo in #​1048

Documentation
Performance
  • 366c2a0 (block) Use Block::bordered by @​EdJoPaTo in #​1041

    Block::bordered() is shorter than

    Block::new().borders(Borders::ALL), requires one less import
    (Borders) and in case Block::default() was used before can even be
    const.

  • 2e71c18 (buffer) Simplify Buffer::filled with macro by @​EdJoPaTo in #​1036

    The `vec![]` macro is highly optimized by the Rust team and shorter.
    Don't do it manually.
    
    This change is mainly cleaner code. The only production code that uses
    this is `Terminal::with_options` and `Terminal::insert_before` so it's
    not performance relevant on every render.
    
  • 81b9633 (calendar) Use const fn by @​EdJoPaTo in #​1039

    Also, do the comparison without `as u8`. Stays the same at runtime and
    is cleaner code.
    
  • c442dfd (canvas) Change map data to const instead of static by @​EdJoPaTo in #​1037

  • 1706b0a (crossterm) Speed up combined fg and bg color changes by up to 20% by @​joshka in #​1072

  • 1a4bb1c (layout) Avoid allocating memory when using split ergonomic utils by @​tranzystorekk in #​1105

    Don't create intermediate vec in `Layout::areas` and
    `Layout::spacers` when there's no need for one.
    
Styling
  • aa4260f (uncategorized) Use std::fmt instead of importing Debug and Display by @​joshka in #​1087

    This is a small universal style change to avoid making this change a
    part of other PRs.
    
    [rationale](https://togithub.com/ratatui-org/ratatui/pull/1083#discussion_r1588466060)
    
Testing
Miscellaneous Tasks
  • 5fbb77a (readme) Use terminal theme for badges by @​TadoTheMiner in #​1026

    The badges in the readme were all the default theme. Giving them
    prettier colors that match the terminal gif is better. I've used the
    colors from the VHS repo.
    
  • bef2bc1 (cargo) Add homepage to Cargo.toml by @​joshka in #​1080

  • 76e5fe5 (uncategorized) Revert "Make Stylize's .bg(color) generic" by @​kdheepak in #​1102

    This reverts commit ec763af8512df731799c8f30c38c37252068a4c4 from #&#8203;1099
    
  • 64eb391 (uncategorized) Fixup cargo lint for windows targets by @​joshka in #​1071

    Crossterm brings in multiple versions of the same dep
    
  • 326a461 (uncategorized) Add package categories field by @​mcskware in #​1035

    Add the package categories field in Cargo.toml, with value
    `["command-line-interface"]`. This fixes the (currently non-default)
    clippy cargo group lint
    [`clippy::cargo_common_metadata`](https://rust-lang.github.io/rust-clippy/master/index.html#/cargo_common_metadata).
    
    As per discussion in [Cargo package categories
    suggestions](https://togithub.com/ratatui-org/ratatui/discussions/1034),
    this lint is not suggested to be run by default in CI, but rather as an
    occasional one-off as part of the larger
    [`clippy::cargo`](https://doc.rust-lang.org/stable/clippy/lints.html#cargo)
    lint group.
    
Build
  • 4955380 (uncategorized) Remove pre-push hooks by @​joshka in #​1115

  • 28e81c0 (uncategorized) Add underline-color to all features flag in makefile by @​joshka in #​1100

  • c75aa19 (uncategorized) Add clippy::cargo lint by @​joshka in #​1053

    Followup to https://github.com/ratatui-org/ratatui/pull/1035 and
    https://github.com/ratatui-org/ratatui/discussions/1034
    
    It's reasonable to enable this and deal with breakage by fixing any
    specific issues that arise.
    
New Contributors

Full Changelog: ratatui/ratatui@v0.26.2...v0.26.3


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 Jun 1, 2024
@oxide-renovate oxide-renovate bot force-pushed the renovate/ratatui-0.x branch 2 times, most recently from 0f15b07 to c8ca884 Compare June 24, 2024 11:12
@oxide-renovate oxide-renovate bot changed the title Update Rust crate ratatui to 0.26.3 Update Rust crate ratatui to 0.27.0 Jun 24, 2024
@oxide-renovate
Copy link
Contributor Author

⚠️ 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.27.0
    Updating crates.io index
error: failed to select a version for the requirement `ratatui = "^0.26"`
candidate versions found which didn't match: 0.27.0
location searched: crates.io index
required by package `tui-tree-widget v0.19.0`
    ... which satisfies dependency `tui-tree-widget = "^0.19.0"` (locked to 0.19.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)`
perhaps a crate was updated and forgotten to be re-vendored?

@oxide-renovate oxide-renovate bot force-pushed the renovate/ratatui-0.x branch from c8ca884 to 50b4795 Compare June 25, 2024 03:11
@oxide-renovate oxide-renovate bot force-pushed the renovate/ratatui-0.x branch from 50b4795 to d7ffa38 Compare June 25, 2024 05:10
@sunshowers sunshowers enabled auto-merge (squash) July 5, 2024 23:23
@oxide-renovate
Copy link
Contributor Author

oxide-renovate bot commented Jul 5, 2024

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 14e3a8b into main Jul 6, 2024
20 of 21 checks passed
@sunshowers sunshowers deleted the renovate/ratatui-0.x branch July 6, 2024 00:27
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