mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-24 13:43:15 +00:00
chore(deps)!: pin unicode-width to 0.2.0 (#1403)
We pin unicode-width to avoid breaking applications when there are breaking changes in the library. Discussion in #1271 Fixes: #1385 Co-authored-by: Josh McKinney <joshka@users.noreply.github.com>
This commit is contained in:
parent
d72968d86b
commit
cc7497532a
3 changed files with 8 additions and 6 deletions
|
@ -39,7 +39,8 @@ termwiz = { version = "0.22.0", optional = true }
|
||||||
time = { version = "0.3.11", optional = true, features = ["local-offset"] }
|
time = { version = "0.3.11", optional = true, features = ["local-offset"] }
|
||||||
unicode-segmentation = "1.10"
|
unicode-segmentation = "1.10"
|
||||||
unicode-truncate = "1"
|
unicode-truncate = "1"
|
||||||
unicode-width = "=0.1.13"
|
# See <https://github.com/ratatui/ratatui/issues/1271> for information about why we pin unicode-width
|
||||||
|
unicode-width = "=0.2.0"
|
||||||
|
|
||||||
[target.'cfg(not(windows))'.dependencies]
|
[target.'cfg(not(windows))'.dependencies]
|
||||||
# termion is not supported on Windows
|
# termion is not supported on Windows
|
||||||
|
|
|
@ -479,12 +479,12 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn buffer_view_with_overwrites() {
|
fn buffer_view_with_overwrites() {
|
||||||
let multi_byte_char = "👨👩👧👦"; // renders 8 wide
|
let multi_byte_char = "👨👩👧👦"; // renders 2 wide
|
||||||
let buffer = Buffer::with_lines([multi_byte_char]);
|
let buffer = Buffer::with_lines([multi_byte_char]);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
buffer_view(&buffer),
|
buffer_view(&buffer),
|
||||||
format!(
|
format!(
|
||||||
r#""{multi_byte_char}" Hidden by multi-width symbols: [(1, " "), (2, " "), (3, " "), (4, " "), (5, " "), (6, " "), (7, " ")]
|
r#""{multi_byte_char}" Hidden by multi-width symbols: [(1, " ")]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1243,11 +1243,12 @@ mod tests {
|
||||||
#[case::shrug("🤷", "🤷xxxxx")]
|
#[case::shrug("🤷", "🤷xxxxx")]
|
||||||
// Technically this is a (brown) bear, a zero-width joiner and a snowflake
|
// Technically this is a (brown) bear, a zero-width joiner and a snowflake
|
||||||
// As it is joined its a single emoji and should therefore have a width of 2.
|
// As it is joined its a single emoji and should therefore have a width of 2.
|
||||||
// It's correctly detected as a single grapheme but it's width is 4 for some reason
|
// Prior to unicode-width 0.2, this was incorrectly detected as width 4 for some reason
|
||||||
#[case::polarbear("🐻❄️", "🐻❄️xxx")]
|
#[case::polarbear("🐻❄️", "🐻❄️xxxxx")]
|
||||||
// Technically this is an eye, a zero-width joiner and a speech bubble
|
// Technically this is an eye, a zero-width joiner and a speech bubble
|
||||||
// Both eye and speech bubble include a 'display as emoji' variation selector
|
// Both eye and speech bubble include a 'display as emoji' variation selector
|
||||||
#[case::eye_speechbubble("👁️🗨️", "👁️🗨️xxx")]
|
// Prior to unicode-width 0.2, this was incorrectly detected as width 4 for some reason
|
||||||
|
#[case::eye_speechbubble("👁️🗨️", "👁️🗨️xxxxx")]
|
||||||
fn renders_emoji(#[case] input: &str, #[case] expected: &str) {
|
fn renders_emoji(#[case] input: &str, #[case] expected: &str) {
|
||||||
use unicode_width::UnicodeWidthChar;
|
use unicode_width::UnicodeWidthChar;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue