mirror of
https://github.com/ratatui/ratatui.git
synced 2025-09-27 04:50:46 +00:00
17 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
![]() |
ae4f42f5ae
|
chore(deps): use less specific versions in manifests (#2041)
The goal of this is to reduce dependabot updates to generally only Cargo.lock updates - Use "0.x" or "x" as the version generally. - Specify versions only in the workspace manifest - Bump versions to latest semver compatible (and update rstest / lru / criterion deps) |
||
![]() |
bbca3870d5
|
build(deps): bump rand from 0.9.1 to 0.9.2 (#2010)
Bumps [rand](https://github.com/rust-random/rand) from 0.9.1 to 0.9.2. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/rust-random/rand/blob/master/CHANGELOG.md">rand's changelog</a>.</em></p> <blockquote> <h2>[0.9.2 — 2025-07-20]</h2> <h3>Deprecated</h3> <ul> <li>Deprecate <code>rand::rngs::mock</code> module and <code>StepRng</code> generator (<a href="https://redirect.github.com/rust-random/rand/issues/1634">#1634</a>)</li> </ul> <h3>Additions</h3> <ul> <li>Enable <code>WeightedIndex<usize></code> (de)serialization (<a href="https://redirect.github.com/rust-random/rand/issues/1646">#1646</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
![]() |
6dcd53bc6b
|
feat: add ergonomic methods for layouting Rects (#1909)
This commit introduces new methods for the `Rect` struct that simplify the process of splitting a `Rect` into sub-rects according to a given `Layout`. By putting these methods on the `Rect` struct, we make it a bit more natural that a layout is applied to the `Rect` itself, rather than passing a `Rect` to the `Layout` struct to be split. Adds: - `Rect::layout` and `Rect::try_layout` methods that allow splitting a `Rect` into an array of sub-rects according to a given `Layout`. - `Rect::layout_vec` method that returns a `Vec` of sub-rects. - `Layout::try_areas` method that returns an array of sub-rects, with compile-time checks for the number of constraints. This is added mainly for consistency with the new `Rect` methods. ```rust use ratatui_core::layout::{Layout, Constraint, Rect}; let area = Rect::new(0, 0, 10, 10); let layout = Layout::vertical([Constraint::Fill(1); 2]); // Rect::layout() infers the number of constraints at compile time: let [top, main] = area.layout(&layout); // Rect::try_layout() and Layout::try_areas() do the same, but return a // Result: let [top, main] = area.try_layout(&layout)?; let [top, main] = layout.try_areas(area)?; // Rect::layout_vec() returns a Vec of sub-rects: let areas_vec = area.layout_vec(&layout); // you can also explicitly specify the number of constraints: let areas = area.layout::<2>(&layout); let areas = area.try_layout::<2>(&layout)?; let areas = layout.try_areas::<2>(area)?; ``` |
||
![]() |
ac22d21deb
|
build(deps): bump color-eyre from 0.6.4 to 0.6.5 (#1889)
Bumps [color-eyre](https://github.com/eyre-rs/eyre) from 0.6.4 to 0.6.5. <details> <summary>Commits</summary> <ul> <li><a href=" |
||
![]() |
dbfb2c3399
|
chore: upgrade to Rust Edition 2024 (#1863)
https://doc.rust-lang.org/edition-guide/rust-2024/index.html Fixes #1727 |
||
![]() |
702fff501c
|
feat!: implement stylize methods directly on Style (#1572)
This makes it possible to create constants using the shorthand methods. ```rust const MY_STYLE: Style = Style::new().blue().on_black(); ``` Rather than implementing Styled for Style and then adding extension methods that implement the Stylize shorthands, this implements the methods as const functions directly on Style. BREAKING CHANGE: `Style` no longer implements `Styled`. Any calls to methods implemented by the blanket implementation of Stylize are now defined directly on Style. Remove the Stylize import if it is no longer used by your code. The `reset()` method does not have a direct replacement, as it clashes with the existing `reset()` method. Use `Style::reset()` rather than `some_style.reset()` Fixes: #1158 |
||
![]() |
8d60e96b2b
|
refactor(examples): use crossterm event methods (#1792)
Crossterm 0.29 introduced methods to easily check / extract the event type. E.g. as_key_press_event() and is_key_press(). This commit updates the examples to use these methods instead of matching on the event type. This makes the code cleaner and easier to read. Also does a general cleanup of the event handling code in the examples. |
||
![]() |
3745a67ba0
|
build(deps): bump rand from 0.9.0 to 0.9.1 (#1804)
Bumps [rand](https://github.com/rust-random/rand) from 0.9.0 to 0.9.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/rust-random/rand/blob/master/CHANGELOG.md">rand's changelog</a>.</em></p> <blockquote> <h2>[0.9.1] - 2025-04-17</h2> <h3>Security and unsafe</h3> <ul> <li>Revise "not a crypto library" policy again (<a href="https://redirect.github.com/rust-random/rand/issues/1565">#1565</a>)</li> <li>Remove <code>zerocopy</code> dependency from <code>rand</code> (<a href="https://redirect.github.com/rust-random/rand/issues/1579">#1579</a>)</li> </ul> <h3>Fixes</h3> <ul> <li>Fix feature <code>simd_support</code> for recent nightly rust (<a href="https://redirect.github.com/rust-random/rand/issues/1586">#1586</a>)</li> </ul> <h3>Changes</h3> <ul> <li>Allow <code>fn rand::seq::index::sample_weighted</code> and <code>fn IndexedRandom::choose_multiple_weighted</code> to return fewer than <code>amount</code> results (<a href="https://redirect.github.com/rust-random/rand/issues/1623">#1623</a>), reverting an undocumented change (<a href="https://redirect.github.com/rust-random/rand/issues/1382">#1382</a>) to the previous release.</li> </ul> <h3>Additions</h3> <ul> <li>Add <code>rand::distr::Alphabetic</code> distribution. (<a href="https://redirect.github.com/rust-random/rand/issues/1587">#1587</a>)</li> <li>Re-export <code>rand_core</code> (<a href="https://redirect.github.com/rust-random/rand/issues/1604">#1604</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
![]() |
0f80c5e87e
|
chore!: use expect() instead of allow() for lint overrides (#1786)
BREAKING CHANGE: MSRV is now 1.81 |
||
![]() |
2739391950
|
style: use Module imports_granularity (#1728)
I was swayed by the arguments about this made by the compiler team In <https://github.com/rust-lang/compiler-team/issues/750> and decided to look at how this organization affects ratatui. I found this reduces the number of lines across the codebase by about 350 and makes the imports more readable and definitely more greppable as you usually only have to read a single line. I've found in the past that maintaining imports regularly leads to merge conflicts which have to be resolved by hand and this change should reduce the likelihood of that happening. Main change is in rustfmt.toml, and the rest is just the result of running `cargo xtask format`. While implementing this, cargo machete brings up that the various backend crates are unused by the example crates. The re-export of each backend crate under ratatui is to make it possible for libs that rely on a specific version of ratatui to use the same version of the backend crate. Apps in general should use the backend crate directly rather than through ratatui as this is less confusing. - Removes all usages of `ratatui::{crossterm, termion, termwiz}`` in the examples. - Adds the backend crate to the dependencies of the examples that use the backend crate directly. |
||
![]() |
dca331c748
|
fix(demo): support tab key in demo2 example (#1726)
see #1721 Not sure what caused this - it's been there for a while probably and we didn't realize it since we used `demo2-destroy` mostly. |
||
![]() |
83774eecf0
|
build(deps): bump time from 0.3.37 to 0.3.39 (#1708)
Bumps [time](https://github.com/time-rs/time) from 0.3.37 to 0.3.39. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/time-rs/time/releases">time's releases</a>.</em></p> <blockquote> <h2>v0.3.39</h2> <p>See the <a href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">changelog</a> for details.</p> <h2>v0.3.38</h2> <p>See the <a href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">changelog</a> for details.</p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">time's changelog</a>.</em></p> <blockquote> <h2>0.3.39 [2025-03-06]</h2> <h3>Fixed</h3> <ul> <li>Doc tests run successfully with the default feature set.</li> <li>wasm builds work again.</li> </ul> <p>Both of these were regressions in v0.3.38 and are now checked in CI.</p> <h2>0.3.38 [2025-03-05]</h2> <h3>Added</h3> <ul> <li> <p>The <code>[year]</code> component (in format descriptions) now supports a <code>range</code> modifier, which can be either <code>standard</code> or <code>extended</code>. The default is <code>extended</code> for backwards compatibility. This is intended as a manner to opt <em>out</em> of the extended range when the <code>large-dates</code> feature is enabled. When the <code>large-dates</code> feature is not enabled, the modifier has no effect.</p> </li> <li> <p><code>UtcDateTime</code>, which is semantically equivalent to an <code>OffsetDateTime</code> with UTC as its offset. The advantage is that it is the same size as a <code>PrimitiveDateTime</code> and has improved operability with well-known formats.</p> <p>As part of this, there were some other additions:</p> <ul> <li><code>utc_datetime!</code> macro, which is similar to the <code>datetime!</code> macro but constructs a <code>UtcDateTime</code>.</li> <li><code>PrimitiveDateTime::as_utc</code></li> <li><code>OffsetDateTime::to_utc</code></li> <li><code>OffsetDateTime::checked_to_utc</code></li> </ul> </li> <li> <p><code>time::serde::timestamp::milliseconds_i64</code>, which is a module to serialize/deserialize timestamps as the Unix timestamp. The pre-existing module does this as an <code>i128</code> where an <code>i64</code> would suffice. This new module should be preferred.</p> </li> </ul> <h3>Changed</h3> <ul> <li><code>error::Format</code> has had its <code>source()</code> implementation changed to no longer return a boxed value from the <code>ComponentRange</code> variant. If you were explicitly expecting this, you will need to update your code. The method API remains unchanged.</li> <li><code>[year repr:century]</code> supports single-digit values.</li> <li>All <code>format_into</code> methods accept <code>?Sized</code> references.</li> </ul> <h3>Miscellaneous</h3> <ul> <li>Some non-exhaustive enum variants that are no longer used have been modified to be statically proven as uninhabited. The relevant fields are doc-hidden and not semver-guaranteed to remain as such, though it is unlikely to change.</li> <li>An unnecessary check when parsing RFC 2822 has been removed.</li> <li>Various methods have had their implementations changed, resulting in significant performance gains. Among the methods changed are <ul> <li><code>util::is_leap_year</code></li> <li><code>util::weeks_in_year</code></li> <li><code>Month::length</code></li> <li><code>Date::to_calendar_date</code></li> </ul> </li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
![]() |
d045305c67
|
chore(deps): bump rand and rand_chacha (#1633)
<https://rust-random.github.io/book/update-0.9.html> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
![]() |
7ad9c29eac
|
feat(linegauge): customized symbols (#1601)
With this PR any symbol (`&str`) can be used to render `filled` and `unfilled` parts of `LineGauge` now. Before that change, only [`symbols::line::Set`](https://docs.rs/ratatui/latest/ratatui/symbols/line/struct.Set.html) was accepted. Note: New methods are introduced to define those symbols: `filled_symbol` and `unfilled_symbol`. The method [`line_set`](https://docs.rs/ratatui/latest/ratatui/widgets/struct.LineGauge.html#method.line_set) is still there, but marked as `deprecated`.  |
||
![]() |
50ba96518f
|
feat: add a new RatatuiMascot widget (#1584)
Move the Mascot from Demo2 into a new widget. Make the Rat grey and adjust the other colors. ```rust frame.render_widget(RatatuiMascot::default(), frame.area()); ``` |
||
![]() |
3646c97840
|
chore(deps): bump time from 0.3.36 to 0.3.37 (#1561)
Bumps [time](https://github.com/time-rs/time) from 0.3.36 to 0.3.37. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/time-rs/time/releases">time's releases</a>.</em></p> <blockquote> <h2>v0.3.37</h2> <p>See the <a href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">changelog</a> for details.</p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/time-rs/time/blob/main/CHANGELOG.md">time's changelog</a>.</em></p> <blockquote> <h2>0.3.37 [2024-12-03]</h2> <h3>Added</h3> <ul> <li><code>Time::MAX</code>, equivalent to <code>time!(23:59:59.999999999)</code></li> <li><code>[year repr:century]</code> is now supported in format descriptions. When used in conjunction with <code>[year repr:last_two]</code>, there is sufficient information to parse a date. Note that with the <code>large-date</code> feature enabled, there is an ambiguity when parsing the two back-to-back.</li> <li>Parsing of <code>strftime</code>-style format descriptions, located at <code>time::format_description::parse_strftime_borrowed</code> and <code>time::format_description::parse_strftime_owned</code></li> <li><code>time::util::refresh_tz</code> and <code>time::util::refresh_tz_unchecked</code>, which updates information obtained via the <code>TZ</code> environment variable. This is equivalent to the <code>tzset</code> syscall on Unix-like systems, with and without built-in soundness checks, respectively.</li> <li><code>Month::length</code> and <code>util::days_in_month</code>, replacing <code>util::days_in_year_month</code>.</li> <li>Expressions are permitted in <code>time::serde::format_description!</code> rather than only paths. This also drastically improves diagnostics when an invalid value is provided.</li> </ul> <h3>Changed</h3> <ul> <li> <p>Obtaining the system UTC offset on Unix-like systems should now succeed when multi-threaded. However, if the <code>TZ</code> environment variable is altered, the program will not be aware of this until <code>time::util::refresh_tz</code> or <code>time::util::refresh_tz_unchecked</code> is called. <code>refresh_tz</code> has the same soundness requirements as obtaining the system UTC offset previously did, with the requirements still being automatically enforced. <code>refresh_tz_unchecked</code> does not enforce these requirements at the expense of being <code>unsafe</code>. Most programs should not need to call either function.</p> <p>Due to this change, the <code>time::util::local_offset</code> module has been deprecated in its entirety. The <code>get_soundness</code> and <code>set_soundness</code> functions are now no-ops.</p> <p>Note that while calls <em>should</em> succeed, success is not guaranteed in any situation. Downstream users should always be prepared to handle the error case.</p> </li> </ul> <h3>Fixed</h3> <ul> <li>Floating point values are truncated, not rounded, when formatting.</li> <li>RFC3339 allows arbitrary separators between the date and time components.</li> <li>Serialization of negative <code>Duration</code>s less than one second is now correct. It previously omitted the negative sign.</li> <li><code>From<js_sys::Date> for OffsetDateTime</code> now ensures sub-millisecond values are not erroneously returned.</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
![]() |
35eba76b4d
|
chore(example): move demo2 to top level folder (#1524) |