build(deps): allow using ratatui with unicode-width 0.2.1 (#1999)

According to the issue linked from Cargo.toml, the intention has been to
manually upgrade unicode-width every now and then, after verifying that
the new version does not disrupt Ratatui. See
https://github.com/ratatui/ratatui/issues/1271#issuecomment-2373917195.

This PR unblocks using Ratatui in a dependency graph where some other
crate requires some of the fixes that landed in unicode-width 0.2.1.
Without this PR, Cargo blocks Ratatui from being used.

```console
error: failed to select a version for `unicode-width`.
    ... required by package `ratatui v0.29.0`
    ... which satisfies dependency `ratatui = "^0.29"` of package `cargo v0.91.0`
    ... which satisfies path dependency `cargo` (locked to 0.91.0) of package `repro v0.0.0`
versions that meet the requirements `=0.2.0` are: 0.2.0

all possible versions conflict with previously selected packages.

  previously selected package `unicode-width v0.2.1`
    ... which satisfies dependency `unicode-width = "^0.2.1"` of package `cargo v0.91.0`
    ... which satisfies path dependency `cargo` (locked to 0.91.0) of package `repro v0.0.0`

failed to select a version for `unicode-width` which could resolve this conflict
```
This commit is contained in:
David Tolnay 2025-07-19 15:23:20 -07:00 committed by GitHub
parent 98f85b8650
commit cdf189e15a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View File

@ -26,6 +26,7 @@ This is a quick summary of the sections below:
feature is enabled
- Disabling `default-features` suppresses the error message if `show_cursor()` fails when dropping
`Terminal`
- Support a broader range for `unicode-width` version
- [v0.29.0](#v0290)
- `Sparkline::data` takes `IntoIterator<Item = SparklineBar>` instead of `&[u64]` and is no longer
const
@ -377,6 +378,17 @@ The `termwiz` backend is upgraded from 0.22.0 to 0.23.0.
This release has a few fixes for hyperlinks and input handling, plus some dependency updates.
See the [commits](https://github.com/wezterm/wezterm/commits/main/termwiz) for more details.
### Support a broader range for `unicode-width` version ([#1999])
[#1999]: https://github.com/ratatui/ratatui/pull/1999
Ratatui's dependency on `unicode-width`, previously pinned to 0.2.0, has
expanded to allow version 0.2.1. This comes with 2 behavior changes described in
[unicode-width#61] and [unicode-width#74].
[unicode-width#61]: https://github.com/unicode-rs/unicode-width/pull/61
[unicode-width#74]: https://github.com/unicode-rs/unicode-width/pull/74
## [v0.29.0](https://github.com/ratatui/ratatui/releases/tag/v0.29.0)
### `Sparkline::data` takes `IntoIterator<Item = SparklineBar>` instead of `&[u64]` and is no longer const ([#1326])

4
Cargo.lock generated
View File

@ -3732,9 +3732,9 @@ dependencies = [
[[package]]
name = "unicode-width"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd"
checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c"
[[package]]
name = "untrusted"

View File

@ -71,7 +71,7 @@ trybuild = "1"
unicode-segmentation = "1"
unicode-truncate = { version = "2", default-features = false }
# See <https://github.com/ratatui/ratatui/issues/1271> for information about why we pin unicode-width
unicode-width = "=0.2.0"
unicode-width = ">=0.2.0, <=0.2.1"
# Improve benchmark consistency
[profile.bench]