Skip to content

Commit

Permalink
Moved from unicode-width to unicode-display-width for visual grapheme…
Browse files Browse the repository at this point in the history
… width estimation
  • Loading branch information
Silvea12 committed Apr 4, 2024
1 parent f533fbe commit 8174314
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "indicatif"
version = "0.17.8"
version = "0.17.9"
edition = "2021"
rust-version = "1.63"
description = "A progress bar and cli reporting library for Rust"
Expand All @@ -13,14 +13,14 @@ readme = "README.md"
exclude = ["screenshots/*"]

[dependencies]
console = { version = "0.15", default-features = false, features = ["ansi-parsing"] }
console = { version = "0.16", default-features = false, features = ["ansi-parsing"] }
futures-core = { version = "0.3", default-features = false, optional = true }
number_prefix = "0.4"
portable-atomic = "1.0.0"
rayon = { version = "1.1", optional = true }
tokio = { version = "1", optional = true, features = ["io-util"] }
unicode-display-width = { version = "0.3", optional = true }
unicode-segmentation = { version = "1", optional = true }
unicode-width = { version = "0.1", optional = true }
vt100 = { version = "0.15.1", optional = true }

[dev-dependencies]
Expand All @@ -35,8 +35,8 @@ pretty_assertions = "1.4.0"
instant = "0.1"

[features]
default = ["unicode-width", "console/unicode-width"]
improved_unicode = ["unicode-segmentation", "unicode-width", "console/unicode-width"]
default = ["unicode-display-width", "console/unicode-display-width"]
improved_unicode = ["unicode-segmentation", "unicode-display-width", "console/unicode-display-width"]
in_memory = ["vt100"]
futures = ["dep:futures-core"]

Expand Down
2 changes: 1 addition & 1 deletion examples/cargo.rs
Expand Up @@ -14,7 +14,7 @@ static CRATES: &[(&str, &str)] = &[
("regex-syntax", "v0.6.23"),
("terminal_size", "v0.1.16"),
("libc", "v0.2.93"),
("unicode-width", "v0.1.8"),
("unicode-display-width", "v0.3.0"),
("lazy_static", "v1.4.0"),
("number_prefix", "v0.4.0"),
("regex", "v1.4.6"),
Expand Down
6 changes: 3 additions & 3 deletions src/style.rs
Expand Up @@ -39,12 +39,12 @@ fn segment(s: &str) -> Vec<Box<str>> {
s.chars().map(|x| x.to_string().into()).collect()
}

#[cfg(feature = "unicode-width")]
#[cfg(feature = "unicode-display-width")]
fn measure(s: &str) -> usize {
unicode_width::UnicodeWidthStr::width(s)
unicode_display_width::width(s) as usize
}

#[cfg(not(feature = "unicode-width"))]
#[cfg(not(feature = "unicode-display-width"))]
fn measure(s: &str) -> usize {
s.chars().count()
}
Expand Down

0 comments on commit 8174314

Please sign in to comment.